From: Tejun Heo <tj@kernel.org>
To: Fernand Sieber <sieberf@amazon.com>
Cc: David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-kernel@vger.kernel.org, nh-open-source@amazon.com,
Fahad Mubeen <fmubeen@amazon.de>,
Hendrik Borghorst <hborghor@amazon.de>,
David Woodhouse <dwmw@amazon.co.uk>
Subject: Re: [RFC PATCH] sched/ext: add sched_info_enqueue in dispatch path for schedstat
Date: Wed, 27 May 2026 09:31:50 -1000 [thread overview]
Message-ID: <ahdGpq5tCP0aKxMV@slm.duckdns.org> (raw)
In-Reply-To: <20260525191942.2349-1-sieberf@amazon.com>
On Mon, May 25, 2026 at 09:19:42PM +0200, Fernand Sieber wrote:
> SCX tasks re-dispatched from BPF (e.g., after bandwidth throttling)
> bypass enqueue_task() and go directly through dispatch_enqueue().
> This skips sched_info_enqueue(), leaving last_queued at 0, which
> prevents run_delay from accumulating in /proc/<pid>/schedstat.
>
> Add sched_info_enqueue() in dispatch_enqueue() when last_queued is
> not already set. This ensures run_delay correctly reflects the time
> a task spends waiting for a CPU after being dispatched, including
> time spent in BPF-managed throttle queues.
>
> Without this fix, schedstat shows frozen run_delay values for SCX
> tasks that go through throttle/unthrottle cycles.
>
> Signed-off-by: Fernand Sieber <sieberf@amazon.com>
> ---
> kernel/sched/ext.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 7ebdaf75d..827a96e39 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -1525,6 +1525,10 @@ static void dispatch_enqueue(struct scx_sched *sch, struct rq *rq,
> WARN_ON_ONCE((p->scx.dsq_flags & SCX_TASK_DSQ_ON_PRIQ) ||
> !RB_EMPTY_NODE(&p->scx.dsq_priq));
>
> + /* Track queue time for schedstat run_delay accounting */
> + if (!p->sched_info.last_queued)
> + sched_info_enqueue(task_rq(p), p);
I don't think this works. A DSQ can be used for throttling too and a BPF
data structure can be used for non-throttling queueing too. I don't see how
doing the above unconditionally would capture something meaningful reliably.
Thanks.
--
tejun
prev parent reply other threads:[~2026-05-27 19:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 19:19 Fernand Sieber
2026-05-27 19:31 ` Tejun Heo [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=ahdGpq5tCP0aKxMV@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=dwmw@amazon.co.uk \
--cc=fmubeen@amazon.de \
--cc=hborghor@amazon.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nh-open-source@amazon.com \
--cc=peterz@infradead.org \
--cc=sieberf@amazon.com \
--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 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®