[rtems commit] score: Simplify _Scheduler_Exchange_idle_thread()
Sebastian Huber
sebh at rtems.org
Tue Nov 23 13:34:54 UTC 2021
Module: rtems
Branch: master
Commit: bd55f69f5bff8e9cc39bae08f489feaa94e1dbb3
Changeset: http://git.rtems.org/rtems/commit/?id=bd55f69f5bff8e9cc39bae08f489feaa94e1dbb3
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Oct 19 11:25:25 2021 +0200
score: Simplify _Scheduler_Exchange_idle_thread()
Remove superfluous idle parameter.
Update #4531.
---
cpukit/include/rtems/score/schedulerimpl.h | 16 +++++++++-------
cpukit/include/rtems/score/schedulersmpimpl.h | 12 ++----------
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h
index 1e83f75..7319cc4 100644
--- a/cpukit/include/rtems/score/schedulerimpl.h
+++ b/cpukit/include/rtems/score/schedulerimpl.h
@@ -1042,22 +1042,24 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Release_idle_thread(
* @brief Exchanges an idle thread from the scheduler node that uses it
* right now to another scheduler node.
*
- * @param needs_idle The scheduler node that needs an idle thread.
- * @param uses_idle The scheduler node that used the idle thread.
- * @param idle The idle thread that is exchanged.
+ * @param needs_idle is the scheduler node that needs an idle thread.
+ *
+ * @param uses_idle is the scheduler node that used the idle thread.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Exchange_idle_thread(
Scheduler_Node *needs_idle,
- Scheduler_Node *uses_idle,
- Thread_Control *idle
+ Scheduler_Node *uses_idle
)
{
- uses_idle->idle = NULL;
+ _Scheduler_Node_set_idle_user(
+ needs_idle,
+ _Scheduler_Node_get_idle( uses_idle )
+ );
_Scheduler_Node_set_user(
uses_idle,
_Scheduler_Node_get_owner( uses_idle )
);
- _Scheduler_Node_set_idle_user( needs_idle, idle );
+ uses_idle->idle = NULL;
}
/**
diff --git a/cpukit/include/rtems/score/schedulersmpimpl.h b/cpukit/include/rtems/score/schedulersmpimpl.h
index f4ee726..a1a048d 100644
--- a/cpukit/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/include/rtems/score/schedulersmpimpl.h
@@ -840,11 +840,7 @@ static inline void _Scheduler_SMP_Enqueue_to_scheduled(
( *insert_scheduled )( context, node, priority );
( *move_from_scheduled_to_ready )( context, lowest_scheduled );
- _Scheduler_Exchange_idle_thread(
- node,
- lowest_scheduled,
- _Scheduler_Node_get_idle( lowest_scheduled )
- );
+ _Scheduler_Exchange_idle_thread( node, lowest_scheduled );
} else {
_Assert( action == SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK );
_Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
@@ -1020,11 +1016,7 @@ static inline bool _Scheduler_SMP_Enqueue_scheduled(
( *insert_ready )( context, node, insert_priority );
( *move_from_ready_to_scheduled )( context, highest_ready );
- _Scheduler_Exchange_idle_thread(
- highest_ready,
- node,
- _Scheduler_Node_get_idle( node )
- );
+ _Scheduler_Exchange_idle_thread( highest_ready, node );
return false;
} else {
_Assert( action == SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK );
More information about the vc
mailing list