[PATCH 13/27] score: Optimize SMP EDF move to ready operation
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Nov 15 17:12:45 UTC 2021
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.
---
cpukit/score/src/scheduleredfsmp.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/cpukit/score/src/scheduleredfsmp.c b/cpukit/score/src/scheduleredfsmp.c
index 7da777e87a..27be08ac40 100644
--- a/cpukit/score/src/scheduleredfsmp.c
+++ b/cpukit/score/src/scheduleredfsmp.c
@@ -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(
--
2.26.2
More information about the devel
mailing list