summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-07 09:40:06 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-07 09:40:06 +0200
commitd19dc071a206789498629747bdf7e433cd05f42c (patch)
tree05ee1d89cfc51878f8b1abfca43f9c46758fef7b
parentsmptests/smpstrongapa01: Simplify (diff)
downloadrtems-d19dc071a206789498629747bdf7e433cd05f42c.tar.bz2
score: Pass scheduler nodes to processor allocator
This allows scheduler implementations to easily access scheduler-specific data. Update #3059.
-rw-r--r--cpukit/score/include/rtems/score/schedulersmpimpl.h32
1 files changed, 14 insertions, 18 deletions
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index b90c359d4c..620a42f863 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -324,8 +324,8 @@ typedef bool ( *Scheduler_SMP_Enqueue )(
typedef void ( *Scheduler_SMP_Allocate_processor )(
Scheduler_Context *context,
- Thread_Control *scheduled_thread,
- Thread_Control *victim_thread,
+ Scheduler_Node *scheduled,
+ Scheduler_Node *victim,
Per_CPU_Control *victim_cpu
);
@@ -476,11 +476,13 @@ static inline void _Scheduler_SMP_Exctract_idle_thread(
static inline void _Scheduler_SMP_Allocate_processor_lazy(
Scheduler_Context *context,
- Thread_Control *scheduled_thread,
- Thread_Control *victim_thread,
+ Scheduler_Node *scheduled,
+ Scheduler_Node *victim,
Per_CPU_Control *victim_cpu
)
{
+ Thread_Control *scheduled_thread = _Scheduler_Node_get_user( scheduled );
+ Thread_Control *victim_thread = _Scheduler_Node_get_user( victim );
Per_CPU_Control *scheduled_cpu = _Thread_Get_CPU( scheduled_thread );
Per_CPU_Control *cpu_self = _Per_CPU_Get();
Thread_Control *heir;
@@ -517,14 +519,16 @@ static inline void _Scheduler_SMP_Allocate_processor_lazy(
*/
static inline void _Scheduler_SMP_Allocate_processor_exact(
Scheduler_Context *context,
- Thread_Control *scheduled_thread,
- Thread_Control *victim_thread,
+ Scheduler_Node *scheduled,
+ Scheduler_Node *victim,
Per_CPU_Control *victim_cpu
)
{
+ Thread_Control *scheduled_thread = _Scheduler_Node_get_user( scheduled );
Per_CPU_Control *cpu_self = _Per_CPU_Get();
(void) context;
+ (void) victim;
_Thread_Set_CPU( scheduled_thread, victim_cpu );
_Thread_Dispatch_update_heir( cpu_self, victim_cpu, scheduled_thread );
@@ -533,21 +537,13 @@ static inline void _Scheduler_SMP_Allocate_processor_exact(
static inline void _Scheduler_SMP_Allocate_processor(
Scheduler_Context *context,
Scheduler_Node *scheduled,
- Thread_Control *victim_thread,
+ Scheduler_Node *victim,
Per_CPU_Control *victim_cpu,
Scheduler_SMP_Allocate_processor allocate_processor
)
{
- Thread_Control *scheduled_thread = _Scheduler_Node_get_user( scheduled );
-
_Scheduler_SMP_Node_change_state( scheduled, SCHEDULER_SMP_NODE_SCHEDULED );
-
- ( *allocate_processor )(
- context,
- scheduled_thread,
- victim_thread,
- victim_cpu
- );
+ ( *allocate_processor )( context, scheduled, victim, victim_cpu );
}
static inline Thread_Control *_Scheduler_SMP_Preempt(
@@ -586,7 +582,7 @@ static inline Thread_Control *_Scheduler_SMP_Preempt(
_Scheduler_SMP_Allocate_processor(
context,
scheduled,
- victim_thread,
+ victim,
victim_cpu,
allocate_processor
);
@@ -888,7 +884,7 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
_Scheduler_SMP_Allocate_processor(
context,
highest_ready,
- _Scheduler_Node_get_user( victim ),
+ victim,
victim_cpu,
allocate_processor
);