diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-18 09:07:07 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-25 18:04:28 +0200 |
commit | 710708d4f922503c8eb376f58f8595afd535ece2 (patch) | |
tree | 2e65f60597865559d8144372a6d152aa4ae937b4 | |
parent | 85fa76fa678498f71b034cd471a92322284b95b9 (diff) |
score: Not set CPU in _Scheduler_Use_idle_thread()
Do not set the CPU of the idle thread in _Scheduler_Use_idle_thread(). This
helps to use _Scheduler_Try_to_schedule_node() under more general conditions in
the future, for example in case the owner and user of a node are not the same.
-rw-r--r-- | cpukit/include/rtems/score/schedulerimpl.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h index af406c2024..9ec7188df3 100644 --- a/cpukit/include/rtems/score/schedulerimpl.h +++ b/cpukit/include/rtems/score/schedulerimpl.h @@ -953,14 +953,12 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Thread_change_state( RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Use_idle_thread( Scheduler_Context *context, Scheduler_Node *node, - Per_CPU_Control *cpu, Scheduler_Get_idle_thread get_idle_thread ) { Thread_Control *idle = ( *get_idle_thread )( context ); _Scheduler_Node_set_idle_user( node, idle ); - _Thread_Set_CPU( idle, cpu ); return idle; } @@ -1037,12 +1035,12 @@ _Scheduler_Try_to_schedule_node( } else if ( idle != NULL ) { action = SCHEDULER_TRY_TO_SCHEDULE_DO_IDLE_EXCHANGE; } else { - _Scheduler_Use_idle_thread( - context, - node, - _Thread_Get_CPU( owner ), - get_idle_thread - ); + Thread_Control *idle; + Thread_Control *user; + + idle = _Scheduler_Use_idle_thread( context, node, get_idle_thread ); + user = _Scheduler_Node_get_user( node ); + _Thread_Set_CPU( idle, _Thread_Get_CPU( user ) ); } _Thread_Scheduler_release_critical( owner, &lock_context ); @@ -1142,12 +1140,8 @@ RTEMS_INLINE_ROUTINE Per_CPU_Control *_Scheduler_Block_node( if ( is_scheduled && _Scheduler_Node_get_idle( node ) == NULL ) { Thread_Control *idle; - idle = _Scheduler_Use_idle_thread( - context, - node, - thread_cpu, - get_idle_thread - ); + idle = _Scheduler_Use_idle_thread( context, node, get_idle_thread ); + _Thread_Set_CPU( idle, thread_cpu ); _Thread_Dispatch_update_heir( _Per_CPU_Get(), thread_cpu, idle ); } |