[rtems commit] score: Pass scheduler nodes to processor allocator

Sebastian Huber sebh at rtems.org
Mon Jul 10 07:39:22 UTC 2017


Module:    rtems
Branch:    master
Commit:    d19dc071a206789498629747bdf7e433cd05f42c
Changeset: http://git.rtems.org/rtems/commit/?id=d19dc071a206789498629747bdf7e433cd05f42c

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jul  7 09:40:06 2017 +0200

score: Pass scheduler nodes to processor allocator

This allows scheduler implementations to easily access
scheduler-specific data.

Update #3059.

---

 .../score/include/rtems/score/schedulersmpimpl.h   | 32 ++++++++++------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index b90c359..620a42f 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
       );



More information about the vc mailing list