From: Kayra Cizmeci <kayracizmeci@gmail.com>
To: Josh Don <joshdon@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
mingo@kernel.org, linux-kernel@vger.kernel.org,
juri.lelli@redhat.com, vincent.guittot@linaro.org,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
kprateek.nayak@amd.com, tj@kernel.org, jakub@okonski.org
Subject: Re: [RFC][PATCH 3/3] sched/eevdf: Fix sched idle task group preemption
Date: Tue, 10 Nov 2026 17:20:43 +0300 [thread overview]
Message-ID: <avMeP-80bZz-zdtO@scheduler.schedules> (raw)
In-Reply-To: <CABk29Nujsg7FNY4yJ3Yd0maT0GEtvxacUWvTDiT5HD=-YVqTvg@mail.gmail.com>
Hi Josh!
On Mon, Nov 09, 2026 at 04:10:30PM -0800, Josh Don wrote:
> > /*
> > - * Preempt the current task with a newly woken task if needed:
> > + * Preempt an idle entity in favor of a non-idle entity (and don't preempt
> > + * in the inverse case).
> > + */
> > +static inline enum preempt_wakeup_action
> > +wakeup_preempt_sched_idle(struct sched_entity *cse, struct sched_entity *pse)
> > +{
> > + int cse_is_idle, pse_is_idle;
> > +
> > + cse_is_idle = se_is_idle(cse);
> > + pse_is_idle = se_is_idle(pse);
> > +
> > + if (cse_is_idle || pse_is_idle) {
> > + find_matching_se(&cse, &pse);
> > + WARN_ON_ONCE(!pse);
> > +
> > + cse_is_idle = se_is_idle(cse);
> > + pse_is_idle = se_is_idle(pse);
>
> now that se_is_idle() is checking for any ancestors with idle, this
> doesn't appear to be correct. Some motivaing examples:
So we want to keep the idle difference between groups with idle
ancestors? FWIW, I asked about this but then thought it was knowingly
and that was what we wanted. I'm still not sure what we want...
>
> Ex 1:
> regular task and SCHED_IDLE task both inside an idle cgroup.
> se_is_idle() will be true for both se's, and so the regular task will
> not end up preempting the SCHED_IDLE task, which would be the
> desirable behavior (the task is not idle relative to the SCHED_IDLE
> task)
>
> cgrp A (idle)
> / \
> regular_task SCHED_IDLE task
>
> Ex2:
> more complex example with a hierarchy of cgroups
>
> root
> |
> cgrp A (idle)
> / \
> cgrp B cgrp C (idle)
> | |
> task_1 task_2
>
> task_1 should preempt task_2, and the inverse should also never
> happen. However, the matching_se here are cgroups B and C, and both
> show se_is_idle() as true
>
> I can think of two simple ways to fix that, either seems fine
> 1) use the existing se_is_idle() check for knowing when we can
> fast-path skip the whole find_matching_se() business, but when we do
> find the matching se, rather than use se_is_idle, use a more targeted
> helper that directly compares just those two entities without any of
> their ancestors (ie. for the task case just check if it has an idle
> policy, and for the group case, just check tg_is_idle())
> 2) once you find the matching se, just compare the ->idle values,
> since if one of them is bigger (by at most 1?), then that one must be
> the "idle" one relatively speaking. Handling the task vs group case
> here seems a bit messier compared to the first option, so my
> suggestion would be to go with the above
>
>
> Best,
> Josh
Cheers,
Kayra :-).
prev parent reply other threads:[~2026-11-10 14:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 16:55 [PATCH 0/3] sched/fair: Fix cgroup::idle preemption Peter Zijlstra
2026-11-05 16:55 ` [PATCH 1/3] sched/fair: Use guard in sched_group_set_idle() Peter Zijlstra
2026-11-05 17:42 ` Kayra Cizmeci
2026-11-06 16:04 ` Vincent Guittot
2026-11-09 23:31 ` Josh Don
2026-11-05 16:55 ` [PATCH 2/3] sched/fair: Make cfs_rq::idle the sum of ancestor tg::idle Peter Zijlstra
2026-11-05 19:20 ` Kayra Cizmeci
2026-11-06 8:31 ` Peter Zijlstra
2026-11-06 8:53 ` Peter Zijlstra
2026-11-06 9:01 ` Kayra Cizmeci
2026-11-06 8:57 ` Kayra Cizmeci
2026-11-06 9:01 ` Peter Zijlstra
2026-11-06 9:11 ` Kayra Cizmeci
2026-11-06 16:24 ` Vincent Guittot
2026-11-07 11:36 ` [PATCH v2 " Peter Zijlstra
2026-11-07 13:13 ` Kayra Cizmeci
2026-11-09 10:13 ` Vincent Guittot
2026-11-09 23:50 ` Josh Don
2026-11-05 16:55 ` [RFC][PATCH 3/3] sched/eevdf: Fix sched idle task group preemption Peter Zijlstra
2026-11-05 20:10 ` Kayra Cizmeci
2026-11-07 13:28 ` Kayra Cizmeci
2026-11-10 0:10 ` Josh Don
2026-11-10 14:20 ` Kayra Cizmeci [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avMeP-80bZz-zdtO@scheduler.schedules \
--to=kayracizmeci@gmail.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=jakub@okonski.org \
--cc=joshdon@google.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®