4.115
Last change
on this file since 2369b10 was
c5831a3f,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/09/14 at 13:07:54
|
score: Add clustered/partitioned scheduling
Clustered/partitioned scheduling helps to control the worst-case
latencies in the system. The goal is to reduce the amount of shared
state in the system and thus prevention of lock contention. Modern
multi-processor systems tend to have several layers of data and
instruction caches. With clustered/partitioned scheduling it is
possible to honour the cache topology of a system and thus avoid
expensive cache synchronization traffic.
We have clustered scheduling in case the set of processors of a system
is partitioned into non-empty pairwise-disjoint subsets. These subsets
are called clusters. Clusters with a cardinality of one are partitions.
Each cluster is owned by exactly one scheduler instance.
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2014 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #if HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/score/schedulerimpl.h> |
---|
20 | |
---|
21 | #if defined(__RTEMS_HAVE_SYS_CPUSET_H__) |
---|
22 | |
---|
23 | bool _Scheduler_Set_affinity( |
---|
24 | Thread_Control *the_thread, |
---|
25 | size_t cpusetsize, |
---|
26 | const cpu_set_t *cpuset |
---|
27 | ) |
---|
28 | { |
---|
29 | bool ok; |
---|
30 | |
---|
31 | if ( _CPU_set_Is_large_enough( cpusetsize ) ) { |
---|
32 | #if defined(RTEMS_SMP) |
---|
33 | uint32_t cpu_count = _SMP_Get_processor_count(); |
---|
34 | uint32_t cpu_index; |
---|
35 | |
---|
36 | ok = false; |
---|
37 | |
---|
38 | for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { |
---|
39 | if ( CPU_ISSET_S( (int) cpu_index, cpusetsize, cpuset ) ) { |
---|
40 | const Scheduler_Control *scheduler_of_cpu = |
---|
41 | _Scheduler_Get_by_CPU_index( cpu_index ); |
---|
42 | |
---|
43 | if ( scheduler_of_cpu != NULL ) { |
---|
44 | ok = ( *scheduler_of_cpu->Operations.set_affinity )( |
---|
45 | scheduler_of_cpu, |
---|
46 | the_thread, |
---|
47 | cpusetsize, |
---|
48 | cpuset |
---|
49 | ); |
---|
50 | } |
---|
51 | |
---|
52 | break; |
---|
53 | } |
---|
54 | } |
---|
55 | #else |
---|
56 | ok = _Scheduler_default_Set_affinity_body( |
---|
57 | _Scheduler_Get( the_thread ), |
---|
58 | the_thread, |
---|
59 | cpusetsize, |
---|
60 | cpuset |
---|
61 | ); |
---|
62 | #endif |
---|
63 | } else { |
---|
64 | ok = false; |
---|
65 | } |
---|
66 | |
---|
67 | return ok; |
---|
68 | } |
---|
69 | |
---|
70 | #endif /* defined(__RTEMS_HAVE_SYS_CPUSET_H__) */ |
---|
Note: See
TracBrowser
for help on using the repository browser.