From: Peter Zijlstra <peterz@infradead.org>
To: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-kernel@vger.kernel.org,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>
Subject: Re: [PATCH] sched/fair: Avoid transient double accounting for delayed tasks
Date: Thu, 12 Nov 2026 12:16:50 +0100 [thread overview]
Message-ID: <20261112111650.GT1779021@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261112083447.25603-1-kprateek.nayak@amd.com>
On Thu, Nov 12, 2026 at 08:34:47AM +0000, K Prateek Nayak wrote:
> When a task is delayed, h_nr_runnable is adjusted via set_delayed().
>
> A dequeue of delayed task with DEQUEUE_DELAYED would decrement
> cfs_rq->h_nr_runnable again in dequeue_hierarchy() and then correct it
> immediately in __dequeue_task() via clear_delayed().
>
> Adding:
>
> WARN_ON_ONCE(((int)cfs_rq->h_nr_runnable) < 0);
>
> in dequeue_hierarchy() after h_nr_runnable accounting is tripped
> reliably during early boot.
>
> Although the cfs_rq->h_nr_runnable accounting is transient, this
> incorrect value gets cached in se->runnable_weight and can affect PELT
> calculation until the next enqueue / dequeue adjusts the runnable
> weight.
>
> Similarly, a task enqueue should never reach enqueue_hierarchy()
> for just ENQUEUE_WAKEUP && se->sched_delayed. Wakeup of delayed tasks
> must couple ENQUEUE_DELAYED which gets correctly handled in
> enqueue_task_fair().
>
> Avoid incorrect accounting in __dequeue_task() and warn for
> incorrect wakeup flags if delayed tasks reaches enqueue with just
> ENQUEUE_WAKEUP.
>
> Fixes: 85570f10a4c6 ("sched/eevdf: Move to a single runqueue")
> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Urgh, thanks!
prev parent reply other threads:[~2026-11-12 11:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 8:34 K Prateek Nayak
2026-11-12 11:16 ` Peter Zijlstra [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=20261112111650.GT1779021@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.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®