Re: [PATCH 2/3] sched/fair: Make cfs_rq::idle the sum of ancestor tg::idle

From: Peter Zijlstra

Date: Thu Nov 12 2026 - 10:23:12 EST


On Thu, Nov 12, 2026 at 05:02:27PM +0300, Kayra Cizmeci wrote:
> :-(.
>
> Look here: https://lore.kernel.org/oe-kbuild-all/202611121431.06YgiErz-lkp@xxxxxxxxx/
>
> On Thu, Nov 05, 2026 at 05:55:27PM +0100, Peter Zijlstra wrote:
> > Rather than keeping cfs_rq::idle as a copy of tg::idle, make it the sum of
> > all ancestor tg::idle. This makes it trivial to tell if the current cgroup
> > is marked idle somewhere along its ancestral path.
> >
> > This makes se_id_idle() behave differently. Notably is will now be true
> > when there is a idle cgroup anywhere in the ancestor path. This
> > addresses an issue where preemption of cgroup::idle was overlooked when
> > flattening the runqueue.
> >
> > Fixes: 85570f10a4c6 ("sched/eevdf: Move to a single runqueue")
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > ---
> > kernel/sched/core.c | 2 -
> > kernel/sched/debug.c | 1
> > kernel/sched/fair.c | 73 ++++++++++++++++++++++++++++++++-------------------
> > kernel/sched/sched.h | 4 +-
> > 4 files changed, 50 insertions(+), 30 deletions(-)
> >
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -8970,7 +8970,7 @@ void __init sched_init(void)
> > rq->nr_running = 0;
> > rq->calc_load_active = 0;
> > rq->calc_load_update = jiffies + LOAD_FREQ;
> > - init_cfs_rq(&rq->cfs);
> > + init_cfs_rq(&rq->cfs, NULL);
> > init_rt_rq(&rq->rt);
> > init_dl_rq(&rq->dl);
> > #ifdef CONFIG_FAIR_GROUP_SCHED
> > --- a/kernel/sched/debug.c
> > +++ b/kernel/sched/debug.c
> > @@ -1090,6 +1090,7 @@ void print_cfs_rq(struct seq_file *m, in
> > SEQ_printf(m, " .%-30s: %d\n", "h_nr_runnable", cfs_rq->h_nr_runnable);
> > SEQ_printf(m, " .%-30s: %d\n", "h_nr_queued", cfs_rq->h_nr_queued);
> > SEQ_printf(m, " .%-30s: %d\n", "h_nr_idle", cfs_rq->h_nr_idle);
> > + SEQ_printf(m, " .%-30s: %d\n", "idle", cfs_rq->idle);
>
> idle is only in the CONFIG_FAIR_GROUP_SCHED :-(.
> So as the robot says, this breaks compiling in !CONFIG_FAIR_GROUP_SCHED.
>
> AFAICT tho, moving this down below in CONFIG_FAIR_GROUP_SCHED next to
> h_load and other guys will solve the issue no?

Yeah, pushed out again, lets see if the robots find more ;-)