From 91a2d5e68b79409689e7748dd6da8d4bd262adac Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 10 Nov 2017 16:21:18 +0100 Subject: score: Adjust _Scheduler_EDF_SMP_Insert_ready() Use only one parameter to compute the next generation. Use index 0 for LIFO ordering, and index 1 for FIFO ordering. --- cpukit/score/include/rtems/score/scheduleredfsmp.h | 2 +- cpukit/score/src/scheduleredfsmp.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'cpukit/score') diff --git a/cpukit/score/include/rtems/score/scheduleredfsmp.h b/cpukit/score/include/rtems/score/scheduleredfsmp.h index 68f01d2c4b..018568190e 100644 --- a/cpukit/score/include/rtems/score/scheduleredfsmp.h +++ b/cpukit/score/include/rtems/score/scheduleredfsmp.h @@ -73,7 +73,7 @@ typedef struct { Scheduler_SMP_Context Base; /** - * @brief Current generation for FIFO/LIFO ordering. + * @brief Current generation for LIFO (index 0) and FIFO (index 1) ordering. */ int64_t generations[ 2 ]; diff --git a/cpukit/score/src/scheduleredfsmp.c b/cpukit/score/src/scheduleredfsmp.c index 82255b0f95..badee44e2e 100644 --- a/cpukit/score/src/scheduleredfsmp.c +++ b/cpukit/score/src/scheduleredfsmp.c @@ -254,8 +254,7 @@ static inline Scheduler_Node *_Scheduler_EDF_SMP_Get_lowest_scheduled( static inline void _Scheduler_EDF_SMP_Insert_ready( Scheduler_Context *context, Scheduler_Node *node_base, - size_t generation_index, - int increment, + int generation_index, bool ( *less )( const void *, const RBTree_Node * ) ) { @@ -263,11 +262,13 @@ static inline void _Scheduler_EDF_SMP_Insert_ready( Scheduler_EDF_SMP_Node *node; uint32_t rqi; Scheduler_EDF_SMP_Ready_queue *ready_queue; + int increment; int64_t generation; self = _Scheduler_EDF_SMP_Get_self( context ); node = _Scheduler_EDF_SMP_Node_downcast( node_base ); rqi = node->ready_queue_index; + increment = ( generation_index << 1 ) - 1; ready_queue = &self->Ready[ rqi ]; generation = self->generations[ generation_index ]; @@ -330,7 +331,6 @@ static inline void _Scheduler_EDF_SMP_Move_from_scheduled_to_ready( _Scheduler_EDF_SMP_Insert_ready( context, scheduled_to_ready, - 0, 1, _Scheduler_EDF_SMP_Less ); @@ -353,8 +353,7 @@ static inline void _Scheduler_EDF_SMP_Insert_ready_lifo( _Scheduler_EDF_SMP_Insert_ready( context, node_to_insert, - 1, - -1, + 0, _Scheduler_EDF_SMP_Less_or_equal ); } @@ -367,7 +366,6 @@ static inline void _Scheduler_EDF_SMP_Insert_ready_fifo( _Scheduler_EDF_SMP_Insert_ready( context, node_to_insert, - 0, 1, _Scheduler_EDF_SMP_Less ); -- cgit v1.2.3