From: Tejun Heo <tj@kernel.org>
To: Kuba Piecuch <jpiecuch@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Josh Don <joshdon@google.com>, David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] sched/core: Don't count voluntary idle picks as forced idle
Date: Tue, 01 Dec 2026 05:11:30 -1000 [thread overview]
Message-ID: <b466b8a51ad8ab28d0c0d0be96f6bc85@kernel.org> (raw)
In-Reply-To: <20261201120123.3678974-2-jpiecuch@google.com>
On Tue, Dec 01, 2026 at 12:03:03PM +0000, Kuba Piecuch wrote:
> In pick_next_task(), the per-sibling loop increments
> rq->core->core_forceidle_count whenever p == rq_i->idle and
> rq_i->nr_running > 0. That conflates a sibling forced idle by a cookie
> mismatch with a sibling whose pick_task() voluntarily returned idle while
> rq_i->nr_running > 0.
>
> Voluntary idle with nr_running > 0 is legitimate whenever a scheduling
> class keeps queued tasks off the CPU and returns NULL from pick_task(),
> such as sched_ext tasks parked on a non-local DSQ. Counting those
> voluntary idle picks as forced idle has two effects:
>
> - If all siblings pick idle (occ == 0), core_forceidle_count becomes
> non-zero while core_forceidle_occupation is 0, triggering
> WARN_ON_ONCE(!rq->core->core_forceidle_occupation) in
> __sched_core_account_forceidle() when schedstats is enabled.
> - If another sibling is running (occ > 0), the voluntary idle time is
> spuriously billed as forced idle to the running sibling's cgroup and
> triggers forced-idle-only paths (queue_core_balance(), forced_idle_rq(),
> sched_core_idle_needs_pick()).
>
> Increment core_forceidle_count and core_forceidle_seq only inside the
> !cookie_equals(p, cookie) branch when sched_core_find() returns NULL and
> replaces a non-idle pick with idle. Since cookie_equals() always returns
> true for rq_i->idle, voluntary idle picks are never counted as forced
> idle, and entering the mismatch branch guarantees a non-idle @max so
> core_forceidle_occupation is always non-zero whenever forced idle is
> recorded.
>
> Fixes: 4feee7d12603 ("sched/core: Forced idle accounting")
> Cc: stable@vger.kernel.org
> Signed-off-by: Kuba Piecuch <jpiecuch@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
Thanks.
--
tejun
next prev parent reply other threads:[~2026-12-01 15:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 12:03 [PATCH 0/2] sched/core: Don't count voluntary idle picks as forced idle Kuba Piecuch
2026-12-01 12:03 ` [PATCH 1/2] " Kuba Piecuch
2026-12-01 15:11 ` Tejun Heo [this message]
2026-12-01 12:03 ` [PATCH 2/2] selftests/sched_ext: Add core_forceidle test for voluntary idle picks Kuba Piecuch
2026-12-01 12:26 ` sashiko-bot
2026-12-01 15:15 ` Kuba Piecuch
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=b466b8a51ad8ab28d0c0d0be96f6bc85@kernel.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=joshdon@google.com \
--cc=jpiecuch@google.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sched-ext@lists.linux.dev \
--cc=vincent.guittot@linaro.org \
--cc=void@manifault.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.