score: Optimize SMP EDF move to ready operation

If a node is moved from the scheduled chain to the ready queue, then we
know that it is the highest priority ready node.  So, it can be
prepended to the ready queue without doing any comparisons.

Update #4531.
This commit is contained in:
Sebastian Huber
2021-11-23 11:00:28 +01:00
parent 9d3e821279
commit 75527ef386
+13 -7
View File
@@ -374,15 +374,21 @@ static inline void _Scheduler_EDF_SMP_Move_from_scheduled_to_ready(
Scheduler_Node *scheduled_to_ready
)
{
Priority_Control insert_priority;
Scheduler_EDF_SMP_Context *self;
Scheduler_EDF_SMP_Node *node;
uint8_t rqi;
Scheduler_EDF_SMP_Ready_queue *ready_queue;
_Scheduler_EDF_SMP_Extract_from_scheduled( context, scheduled_to_ready );
insert_priority = _Scheduler_SMP_Node_priority( scheduled_to_ready );
_Scheduler_EDF_SMP_Insert_ready(
context,
scheduled_to_ready,
insert_priority
);
self = _Scheduler_EDF_SMP_Get_self( context );
node = _Scheduler_EDF_SMP_Node_downcast( scheduled_to_ready );
rqi = node->ready_queue_index;
ready_queue = &self->Ready[ rqi ];
_Scheduler_EDF_SMP_Activate_ready_queue_if_necessary( self, rqi, ready_queue );
_RBTree_Initialize_node( &node->Base.Base.Node.RBTree );
_RBTree_Prepend( &ready_queue->Queue, &node->Base.Base.Node.RBTree );
}
static inline void _Scheduler_EDF_SMP_Move_from_ready_to_scheduled(