Re: [PATCH 08/20 v3] sched/fair: Add push task mechanism for fair
From: Peter Zijlstra
Date: Thu Nov 12 2026 - 05:40:08 EST
On Thu, Nov 12, 2026 at 08:01:17AM +0100, Vincent Guittot wrote:
> I don't want to take any random task from the rq but only one that is
> meaningful. Why do you think having a dedicated pushable list like rt
> and deadline isn't worthwhile?
Well, effectively cfs_tasks *is* the pushable list. The below patch
makes no effective difference, and can be argued to be an optimization.
Currently every consumer of cfs_tasks goes through can_migrate_task()
and every task that has nr_cpus_allowed == 1, will fail that function.
The thing seems to be that you want additional constraints on your list;
like dropping tasks after one push attempt. The other classes don't do
that, they do the same thing cfs_tasks does and keep all runnable tasks
that can migrate on the list.
I'm not against adding another list per-se, I'm just struggling to
understand your extra semantics, because its not _just_ another pushable
list, it has some extra flavour.
---
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0552eaf64e95..8c81d236b24d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4693,7 +4693,8 @@ account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
account_numa_enqueue(rq, p);
account_llc_enqueue(rq, p);
- list_add(&se->group_node, &rq->cfs_tasks);
+ if (p->nr_cpus_allowed > 1)
+ list_add(&se->group_node, &rq->cfs_tasks);
}
cfs_rq->nr_queued++;
}
@@ -4709,7 +4710,8 @@ account_entity_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se)
account_numa_dequeue(rq, p);
account_llc_dequeue(rq, p);
- list_del_init(&se->group_node);
+ if (p->nr_cpus_allowed > 1)
+ list_del_init(&se->group_node);
}
cfs_rq->nr_queued--;
}
@@ -15620,7 +15622,7 @@ static void set_next_task_fair(struct rq *rq, struct task_struct *p, enum snt_e
set_protect_slice(cfs_rq, se);
}
- if (task_on_rq_queued(p)) {
+ if (task_on_rq_queued(p) && p->nr_cpus_allowed > 1) {
/*
* Move the next running task to the front of the list, so our
* cfs_tasks list becomes MRU one.