[rtems commit] score: Strong APA scheduler processor allocation

Sebastian Huber sebh at rtems.org
Thu Jun 30 07:55:17 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Jun 30 06:23:56 2016 +0200

score: Strong APA scheduler processor allocation

Use _Scheduler_SMP_Allocate_processor_exact() to prevent unexpected
migrations.

---

 cpukit/score/include/rtems/score/schedulersmpimpl.h | 21 +++++++++++++++++++++
 cpukit/score/src/schedulerpriorityaffinitysmp.c     | 21 ---------------------
 cpukit/score/src/schedulerstrongapa.c               |  6 +++---
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index a6796a5..f2c9919 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -487,6 +487,27 @@ static inline void _Scheduler_SMP_Allocate_processor_lazy(
   }
 }
 
+/*
+ * This method is slightly different from
+ * _Scheduler_SMP_Allocate_processor_lazy() in that it does what it is asked to
+ * do.  _Scheduler_SMP_Allocate_processor_lazy() attempts to prevent migrations
+ * but does not take into account affinity.
+ */
+static inline void _Scheduler_SMP_Allocate_processor_exact(
+  Scheduler_Context *context,
+  Thread_Control    *scheduled_thread,
+  Thread_Control    *victim_thread
+)
+{
+  Per_CPU_Control *victim_cpu = _Thread_Get_CPU( victim_thread );
+  Per_CPU_Control *cpu_self = _Per_CPU_Get();
+
+  (void) context;
+
+  _Thread_Set_CPU( scheduled_thread, victim_cpu );
+  _Thread_Dispatch_update_heir( cpu_self, victim_cpu, scheduled_thread );
+}
+
 static inline void _Scheduler_SMP_Allocate_processor(
   Scheduler_Context                *context,
   Scheduler_Node                   *scheduled,
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 3618f4c..76b4601 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -113,27 +113,6 @@ void _Scheduler_priority_affinity_SMP_Node_initialize(
 }
 
 /*
- * This method is slightly different from
- * _Scheduler_SMP_Allocate_processor_lazy() in that it does what it is asked to
- * do. _Scheduler_SMP_Allocate_processor_lazy() attempts to prevent migrations
- * but does not take into account affinity.
- */
-static inline void _Scheduler_SMP_Allocate_processor_exact(
-  Scheduler_Context *context,
-  Thread_Control    *scheduled_thread,
-  Thread_Control    *victim_thread
-)
-{
-  Per_CPU_Control *victim_cpu = _Thread_Get_CPU( victim_thread );
-  Per_CPU_Control *cpu_self = _Per_CPU_Get();
-
-  (void) context;
-
-  _Thread_Set_CPU( scheduled_thread, victim_cpu );
-  _Thread_Dispatch_update_heir( cpu_self, victim_cpu, scheduled_thread );
-}
-
-/*
  * This method is unique to this scheduler because it takes into
  * account affinity as it determines the highest ready thread.
  * Since this is used to pick a new thread to replace the victim,
diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c
index 51dac67..14c238e 100644
--- a/cpukit/score/src/schedulerstrongapa.c
+++ b/cpukit/score/src/schedulerstrongapa.c
@@ -225,7 +225,7 @@ void _Scheduler_strong_APA_Block(
     _Scheduler_strong_APA_Extract_from_ready,
     _Scheduler_strong_APA_Get_highest_ready,
     _Scheduler_strong_APA_Move_from_ready_to_scheduled,
-    _Scheduler_SMP_Allocate_processor_lazy
+    _Scheduler_SMP_Allocate_processor_exact
   );
 }
 
@@ -247,7 +247,7 @@ static Thread_Control *_Scheduler_strong_APA_Enqueue_ordered(
     insert_scheduled,
     _Scheduler_strong_APA_Move_from_scheduled_to_ready,
     _Scheduler_SMP_Get_lowest_scheduled,
-    _Scheduler_SMP_Allocate_processor_lazy
+    _Scheduler_SMP_Allocate_processor_exact
   );
 }
 
@@ -300,7 +300,7 @@ static Thread_Control *_Scheduler_strong_APA_Enqueue_scheduled_ordered(
     insert_ready,
     insert_scheduled,
     _Scheduler_strong_APA_Move_from_ready_to_scheduled,
-    _Scheduler_SMP_Allocate_processor_lazy
+    _Scheduler_SMP_Allocate_processor_exact
   );
 }
 




More information about the vc mailing list