static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq)
{
struct rb_node *node = cfs_rq->tasks_timeline.rb_root.rb_node;
+ struct sched_entity *se = __pick_first_entity(cfs_rq);
struct sched_entity *curr = cfs_rq->curr;
struct sched_entity *best = NULL;
* in this cfs_rq, saving some cycles.
*/
if (cfs_rq->nr_running == 1)
- return curr && curr->on_rq ? curr : __node_2_se(node);
+ return curr && curr->on_rq ? curr : se;
if (curr && (!curr->on_rq || !entity_eligible(cfs_rq, curr)))
curr = NULL;
if (sched_feat(RUN_TO_PARITY) && curr && curr->vlag == curr->deadline)
return curr;
+ /* Pick the leftmost entity if it's eligible */
+ if (se && entity_eligible(cfs_rq, se)) {
+ best = se;
+ goto found;
+ }
+
/* Heap search for the EEVD entity */
while (node) {
- struct sched_entity *se = __node_2_se(node);
struct rb_node *left = node->rb_left;
/*
continue;
}
+ se = __node_2_se(node);
+
/*
* The left subtree either is empty or has no eligible
* entity, so check the current node since it is the one
node = node->rb_right;
}
-
+found:
if (!best || (curr && entity_before(curr, best)))
best = curr;