[rtems commit] score: Scheduler insert after move

Sebastian Huber sebh at rtems.org
Tue Nov 23 13:34:54 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Oct 19 12:43:47 2021 +0200

score: Scheduler insert after move

Insert nodes after moving the second node to reduce the items in the
data structure for the insert operation.  This also avoids having two
nodes for the same processor inserted into the scheduled chain.

Update #4531.

---

 cpukit/include/rtems/score/schedulersmpimpl.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cpukit/include/rtems/score/schedulersmpimpl.h b/cpukit/include/rtems/score/schedulersmpimpl.h
index a074b53..a93bb50 100644
--- a/cpukit/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/include/rtems/score/schedulersmpimpl.h
@@ -822,8 +822,8 @@ static inline void _Scheduler_SMP_Enqueue_to_scheduled(
       allocate_processor
     );
 
-    ( *insert_scheduled )( context, node, priority );
     ( *move_from_scheduled_to_ready )( context, lowest_scheduled );
+    ( *insert_scheduled )( context, node, priority );
 
     _Scheduler_Release_idle_thread(
       context,
@@ -837,8 +837,8 @@ static inline void _Scheduler_SMP_Enqueue_to_scheduled(
     );
     _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_SCHEDULED );
 
-    ( *insert_scheduled )( context, node, priority );
     ( *move_from_scheduled_to_ready )( context, lowest_scheduled );
+    ( *insert_scheduled )( context, node, priority );
 
     _Scheduler_Exchange_idle_thread( node, lowest_scheduled );
   } else {
@@ -997,8 +997,8 @@ static inline bool _Scheduler_SMP_Enqueue_scheduled(
         allocate_processor
       );
 
-      ( *insert_ready )( context, node, insert_priority );
       ( *move_from_ready_to_scheduled )( context, highest_ready );
+      ( *insert_ready )( context, node, insert_priority );
 
       idle = _Scheduler_Release_idle_thread(
         context,
@@ -1013,8 +1013,8 @@ static inline bool _Scheduler_SMP_Enqueue_scheduled(
         SCHEDULER_SMP_NODE_SCHEDULED
       );
 
-      ( *insert_ready )( context, node, insert_priority );
       ( *move_from_ready_to_scheduled )( context, highest_ready );
+      ( *insert_ready )( context, node, insert_priority );
 
       _Scheduler_Exchange_idle_thread( highest_ready, node );
       return false;
@@ -1522,8 +1522,8 @@ static inline bool _Scheduler_SMP_Ask_for_help(
           allocate_processor
         );
 
-        ( *insert_scheduled )( context, node, insert_priority );
         ( *move_from_scheduled_to_ready )( context, lowest_scheduled );
+        ( *insert_scheduled )( context, node, insert_priority );
 
         _Scheduler_Release_idle_thread(
           context,



More information about the vc mailing list