diff options
Diffstat (limited to 'cpukit/score/src/schedulersimplesmp.c')
-rw-r--r-- | cpukit/score/src/schedulersimplesmp.c | 161 |
1 files changed, 41 insertions, 120 deletions
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c index df08a19eab..4ab4987c3a 100644 --- a/cpukit/score/src/schedulersimplesmp.c +++ b/cpukit/score/src/schedulersimplesmp.c @@ -99,17 +99,17 @@ static void _Scheduler_simple_SMP_Move_from_scheduled_to_ready( ) { Scheduler_simple_SMP_Context *self; - Priority_Control priority_to_insert; + Priority_Control insert_priority; self = _Scheduler_simple_SMP_Get_self( context ); - priority_to_insert = _Scheduler_SMP_Node_priority( scheduled_to_ready ); _Chain_Extract_unprotected( &scheduled_to_ready->Node.Chain ); + insert_priority = _Scheduler_SMP_Node_priority( scheduled_to_ready ); _Chain_Insert_ordered_unprotected( &self->Ready, &scheduled_to_ready->Node.Chain, - &priority_to_insert, - _Scheduler_SMP_Insert_priority_lifo_order + &insert_priority, + _Scheduler_SMP_Priority_less_equal ); } @@ -119,55 +119,36 @@ static void _Scheduler_simple_SMP_Move_from_ready_to_scheduled( ) { Scheduler_simple_SMP_Context *self; - Priority_Control priority_to_insert; + Priority_Control insert_priority; self = _Scheduler_simple_SMP_Get_self( context ); - priority_to_insert = _Scheduler_SMP_Node_priority( ready_to_scheduled ); _Chain_Extract_unprotected( &ready_to_scheduled->Node.Chain ); + insert_priority = _Scheduler_SMP_Node_priority( ready_to_scheduled ); + insert_priority = SCHEDULER_PRIORITY_APPEND( insert_priority ); _Chain_Insert_ordered_unprotected( &self->Base.Scheduled, &ready_to_scheduled->Node.Chain, - &priority_to_insert, - _Scheduler_SMP_Insert_priority_fifo_order + &insert_priority, + _Scheduler_SMP_Priority_less_equal ); } -static void _Scheduler_simple_SMP_Insert_ready_lifo( +static void _Scheduler_simple_SMP_Insert_ready( Scheduler_Context *context, - Scheduler_Node *node_to_insert + Scheduler_Node *node_to_insert, + Priority_Control insert_priority ) { Scheduler_simple_SMP_Context *self; - Priority_Control priority_to_insert; self = _Scheduler_simple_SMP_Get_self( context ); - priority_to_insert = _Scheduler_SMP_Node_priority( node_to_insert ); _Chain_Insert_ordered_unprotected( &self->Ready, &node_to_insert->Node.Chain, - &priority_to_insert, - _Scheduler_SMP_Insert_priority_lifo_order - ); -} - -static void _Scheduler_simple_SMP_Insert_ready_fifo( - Scheduler_Context *context, - Scheduler_Node *node_to_insert -) -{ - Scheduler_simple_SMP_Context *self; - Priority_Control priority_to_insert; - - self = _Scheduler_simple_SMP_Get_self( context ); - priority_to_insert = _Scheduler_SMP_Node_priority( node_to_insert ); - - _Chain_Insert_ordered_unprotected( - &self->Ready, - &node_to_insert->Node.Chain, - &priority_to_insert, - _Scheduler_SMP_Insert_priority_fifo_order + &insert_priority, + _Scheduler_SMP_Priority_less_equal ); } @@ -200,103 +181,45 @@ void _Scheduler_simple_SMP_Block( ); } -static bool _Scheduler_simple_SMP_Enqueue_ordered( - Scheduler_Context *context, - Scheduler_Node *node, - Chain_Node_order order, - Scheduler_SMP_Insert insert_ready, - Scheduler_SMP_Insert insert_scheduled +static bool _Scheduler_simple_SMP_Enqueue( + Scheduler_Context *context, + Scheduler_Node *node, + Priority_Control insert_priority ) { - return _Scheduler_SMP_Enqueue_ordered( + return _Scheduler_SMP_Enqueue( context, node, - order, - insert_ready, - insert_scheduled, + insert_priority, + _Scheduler_SMP_Priority_less_equal, + _Scheduler_simple_SMP_Insert_ready, + _Scheduler_SMP_Insert_scheduled, _Scheduler_simple_SMP_Move_from_scheduled_to_ready, _Scheduler_SMP_Get_lowest_scheduled, _Scheduler_SMP_Allocate_processor_lazy ); } -static bool _Scheduler_simple_SMP_Enqueue_lifo( - Scheduler_Context *context, - Scheduler_Node *node -) -{ - return _Scheduler_simple_SMP_Enqueue_ordered( - context, - node, - _Scheduler_SMP_Insert_priority_lifo_order, - _Scheduler_simple_SMP_Insert_ready_lifo, - _Scheduler_SMP_Insert_scheduled_lifo - ); -} - -static bool _Scheduler_simple_SMP_Enqueue_fifo( - Scheduler_Context *context, - Scheduler_Node *node -) -{ - return _Scheduler_simple_SMP_Enqueue_ordered( - context, - node, - _Scheduler_SMP_Insert_priority_fifo_order, - _Scheduler_simple_SMP_Insert_ready_fifo, - _Scheduler_SMP_Insert_scheduled_fifo - ); -} - -static bool _Scheduler_simple_SMP_Enqueue_scheduled_ordered( +static bool _Scheduler_simple_SMP_Enqueue_scheduled( Scheduler_Context *context, - Scheduler_Node *node, - Chain_Node_order order, - Scheduler_SMP_Insert insert_ready, - Scheduler_SMP_Insert insert_scheduled + Scheduler_Node *node, + Priority_Control insert_priority ) { - return _Scheduler_SMP_Enqueue_scheduled_ordered( + return _Scheduler_SMP_Enqueue_scheduled( context, node, - order, + insert_priority, + _Scheduler_SMP_Priority_less_equal, _Scheduler_simple_SMP_Extract_from_ready, _Scheduler_simple_SMP_Get_highest_ready, - insert_ready, - insert_scheduled, + _Scheduler_simple_SMP_Insert_ready, + _Scheduler_SMP_Insert_scheduled, _Scheduler_simple_SMP_Move_from_ready_to_scheduled, _Scheduler_SMP_Allocate_processor_lazy ); } -static bool _Scheduler_simple_SMP_Enqueue_scheduled_lifo( - Scheduler_Context *context, - Scheduler_Node *node -) -{ - return _Scheduler_simple_SMP_Enqueue_scheduled_ordered( - context, - node, - _Scheduler_SMP_Insert_priority_lifo_order, - _Scheduler_simple_SMP_Insert_ready_lifo, - _Scheduler_SMP_Insert_scheduled_lifo - ); -} - -static bool _Scheduler_simple_SMP_Enqueue_scheduled_fifo( - Scheduler_Context *context, - Scheduler_Node *node -) -{ - return _Scheduler_simple_SMP_Enqueue_scheduled_ordered( - context, - node, - _Scheduler_SMP_Insert_priority_fifo_order, - _Scheduler_simple_SMP_Insert_ready_fifo, - _Scheduler_SMP_Insert_scheduled_fifo - ); -} - void _Scheduler_simple_SMP_Unblock( const Scheduler_Control *scheduler, Thread_Control *thread, @@ -310,7 +233,7 @@ void _Scheduler_simple_SMP_Unblock( thread, node, _Scheduler_simple_SMP_Do_update, - _Scheduler_simple_SMP_Enqueue_fifo + _Scheduler_simple_SMP_Enqueue ); } @@ -324,9 +247,9 @@ static bool _Scheduler_simple_SMP_Do_ask_for_help( context, the_thread, node, - _Scheduler_SMP_Insert_priority_lifo_order, - _Scheduler_simple_SMP_Insert_ready_lifo, - _Scheduler_SMP_Insert_scheduled_lifo, + _Scheduler_SMP_Priority_less_equal, + _Scheduler_simple_SMP_Insert_ready, + _Scheduler_SMP_Insert_scheduled, _Scheduler_simple_SMP_Move_from_scheduled_to_ready, _Scheduler_SMP_Get_lowest_scheduled, _Scheduler_SMP_Allocate_processor_lazy @@ -347,10 +270,8 @@ void _Scheduler_simple_SMP_Update_priority( node, _Scheduler_simple_SMP_Extract_from_ready, _Scheduler_simple_SMP_Do_update, - _Scheduler_simple_SMP_Enqueue_fifo, - _Scheduler_simple_SMP_Enqueue_lifo, - _Scheduler_simple_SMP_Enqueue_scheduled_fifo, - _Scheduler_simple_SMP_Enqueue_scheduled_lifo, + _Scheduler_simple_SMP_Enqueue, + _Scheduler_simple_SMP_Enqueue_scheduled, _Scheduler_simple_SMP_Do_ask_for_help ); } @@ -414,7 +335,7 @@ void _Scheduler_simple_SMP_Add_processor( context, idle, _Scheduler_simple_SMP_Has_ready, - _Scheduler_simple_SMP_Enqueue_scheduled_fifo, + _Scheduler_simple_SMP_Enqueue_scheduled, _Scheduler_SMP_Do_nothing_register_idle ); } @@ -430,7 +351,7 @@ Thread_Control *_Scheduler_simple_SMP_Remove_processor( context, cpu, _Scheduler_simple_SMP_Extract_from_ready, - _Scheduler_simple_SMP_Enqueue_fifo + _Scheduler_simple_SMP_Enqueue ); } @@ -447,7 +368,7 @@ void _Scheduler_simple_SMP_Yield( thread, node, _Scheduler_simple_SMP_Extract_from_ready, - _Scheduler_simple_SMP_Enqueue_fifo, - _Scheduler_simple_SMP_Enqueue_scheduled_fifo + _Scheduler_simple_SMP_Enqueue, + _Scheduler_simple_SMP_Enqueue_scheduled ); } |