summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/schedulerimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-07 06:25:03 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-09 15:27:29 +0100
commit1c46b80329d5d099022d8c7e0a8c593845120729 (patch)
tree10806fd4ca26dd0a7b3410baf1187575d6bc8102 /cpukit/score/include/rtems/score/schedulerimpl.h
parentscore: Avoid _Scheduler_Get_by_CPU_index( 0 ) (diff)
downloadrtems-1c46b80329d5d099022d8c7e0a8c593845120729.tar.bz2
score: Add scheduler to per-CPU information
This makes it possible to adjust the scheduler of a processor at run-time. Update #2797.
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulerimpl.h')
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h36
1 files changed, 16 insertions, 20 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 8d804bb0e4..de9af50db9 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -53,28 +53,18 @@ RTEMS_INLINE_ROUTINE Scheduler_Context *_Scheduler_Get_context(
return scheduler->context;
}
-RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get_by_CPU_index(
- uint32_t cpu_index
+RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get_by_CPU(
+ const Per_CPU_Control *cpu
)
{
#if defined(RTEMS_SMP)
- return _Scheduler_Assignments[ cpu_index ].scheduler;
+ return cpu->Scheduler.control;
#else
- (void) cpu_index;
-
+ (void) cpu;
return &_Scheduler_Table[ 0 ];
#endif
}
-RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get_by_CPU(
- const Per_CPU_Control *cpu
-)
-{
- uint32_t cpu_index = _Per_CPU_Get_index( cpu );
-
- return _Scheduler_Get_by_CPU_index( cpu_index );
-}
-
/**
* @brief Acquires the scheduler instance inside a critical section (interrupts
* disabled).
@@ -673,14 +663,17 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Should_start_processor(
RTEMS_INLINE_ROUTINE bool _Scheduler_Has_processor_ownership(
const Scheduler_Control *scheduler,
- uint32_t cpu_index
+ uint32_t cpu_index
)
{
#if defined(RTEMS_SMP)
- const Scheduler_Assignment *assignment =
- _Scheduler_Get_assignment( cpu_index );
+ const Per_CPU_Control *cpu;
+ const Scheduler_Control *scheduler_of_cpu;
+
+ cpu = _Per_CPU_Get_by_index( cpu_index );
+ scheduler_of_cpu = _Scheduler_Get_by_CPU( cpu );
- return assignment->scheduler == scheduler;
+ return scheduler_of_cpu == scheduler;
#else
(void) scheduler;
(void) cpu_index;
@@ -748,8 +741,11 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
#if defined(RTEMS_SMP)
- const Scheduler_Control *scheduler_of_cpu =
- _Scheduler_Get_by_CPU_index( cpu_index );
+ const Per_CPU_Control *cpu;
+ const Scheduler_Control *scheduler_of_cpu;
+
+ cpu = _Per_CPU_Get_by_index( cpu_index );
+ scheduler_of_cpu = _Scheduler_Get_by_CPU( cpu );
ok = ok
&& ( CPU_ISSET_S( (int) cpu_index, cpusetsize, cpuset )