[PATCH 2/3] score: Modify _Scheduler_Unblock()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 7 13:48:20 UTC 2018


In SMP configurations, obtain the scheduler node for the block and
unblock operations through the same way via
Thread_Control::Scheduler::Scheduler_node.  This symmetry is important
in a follow up patch which introduces thread pinning.

Update #3508.
---
 cpukit/include/rtems/score/schedulerimpl.h | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h
index 10c12242a9..2fe30b3d6b 100644
--- a/cpukit/include/rtems/score/schedulerimpl.h
+++ b/cpukit/include/rtems/score/schedulerimpl.h
@@ -299,16 +299,22 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block( Thread_Control *the_thread )
  */
 RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( Thread_Control *the_thread )
 {
+  Scheduler_Node          *scheduler_node;
   const Scheduler_Control *scheduler;
   ISR_lock_Context         lock_context;
 
+#if defined(RTEMS_SMP)
+  scheduler_node = SCHEDULER_NODE_OF_THREAD_SCHEDULER_NODE(
+    _Chain_First( &the_thread->Scheduler.Scheduler_nodes )
+  );
+  scheduler = _Scheduler_Node_get_scheduler( scheduler_node );
+#else
+  scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
   scheduler = _Thread_Scheduler_get_home( the_thread );
+#endif
+
   _Scheduler_Acquire_critical( scheduler, &lock_context );
-  ( *scheduler->Operations.unblock )(
-    scheduler,
-    the_thread,
-    _Thread_Scheduler_get_home_node( the_thread )
-  );
+  ( *scheduler->Operations.unblock )( scheduler, the_thread, scheduler_node );
   _Scheduler_Release_critical( scheduler, &lock_context );
 }
 
-- 
2.13.7




More information about the devel mailing list