Re: [PATCH 08/20 v3] sched/fair: Add push task mechanism for fair
From: Li kunyu
Date: Fri Nov 13 2026 - 05:46:58 EST
Hi,
On 2026/11/6 23:19, Vincent Guittot wrote:
> /*
> * select_task_rq_fair: Select a target runqueue for the task.
> * There are 2 ways to select the target runqueue:
> @@ -10552,6 +10712,18 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, struct t
> cfs_rq->curr = NULL;
> if (se->on_rq)
> __enqueue_entity(cfs_rq, se);
> +
> + if (next) {
> + /*
> + * The previous task might be eligible for being pushed on another cpu
> + * if it is still active.
> + */
> + if (next != prev)
> + fair_add_pushable_prev(rq, prev, next);
> +
> + if (next->sched_class != &fair_sched_class)
> + fair_queue_push_tasks(rq);
> + }
Regarding if (next->sched_class != &fair_sched_class) - would it be more
semantically correct to change it to if (sched_class_above(next->sched_class,
&fair_sched_class))? The current code migrates all CFS tasks on the current rq
whenever the next task is not of the fair class; I think it would be more
appropriate to do this only when the next task has a higher scheduling priority.
I'm not sure whether my understanding is correct.
--
thanks,
kunyu