mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: mingo@redhat.com, hannes@cmpxchg.org, surenb@google.com,
	jstultz@google.com, connoro@google.com, metin.kaya@arm.com,
	sh_def@163.com, 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,
	linux-kernel@vger.kernel.org, zhanxusheng@xiaomi.com
Subject: Re: [PATCH] sched/core: Account PSI IRQ time to the execution context
Date: Tue, 22 Sep 2026 10:17:06 +0200	[thread overview]
Message-ID: <20260922081706.GE2009045@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260918132915.1236312-1-zhanxusheng@xiaomi.com>

On Fri, Sep 18, 2026 at 09:29:15PM +0800, Zhan Xusheng wrote:
> psi_account_irqtime() has two callers which share rq->psi_irq_time, and
> they disagree about the context: __schedule() passes the outgoing rq->curr,
> sched_tick() passes rq->donor.  Under proxy execution the donor is blocked
> on a mutex while rq->curr burns the CPU.
> 
> The tick charges PSI_IRQ_FULL to the donor's cgroup and advances the
> timestamp, so the call from __schedule() then finds delta <= 0 and charges
> nothing.  The delta is not counted twice, it lands on the wrong cgroup.
> 
> Pass rq->curr, which is what the call read before commit af0c8b2bf67b
> ("sched: Split scheduler and execution contexts") renamed curr to donor
> across sched_tick().  Without CONFIG_SCHED_PROXY_EXEC the two rq members
> are a union, so this only changes anything where that option is set, and
> it depends on EXPERT.
> 
> Fixes: af0c8b2bf67b ("sched: Split scheduler and execution contexts")
> Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
> ---
> Built and booted on x86_64 with CONFIG_SCHED_PROXY_EXEC=y, PSI and
> IRQ_TIME_ACCOUNTING enabled, under x86_debug.config and panic_on_warn.
> I did not construct a case where donor and curr differ.
>  kernel/sched/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 7885ff76e69f..2b48ae0ab372 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5791,7 +5791,7 @@ void sched_tick(void)
>  	curr = rq->curr;
>  	donor = rq->donor;
>  
> -	psi_account_irqtime(rq, donor, NULL);
> +	psi_account_irqtime(rq, curr, NULL);
>  
>  	update_rq_clock(rq);
>  	hw_pressure = arch_scale_hw_pressure(cpu_of(rq));

Does not in fact apply. There is no curr in sched_tick anymore.

  parent reply	other threads:[~2026-09-22  8:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 13:29 Zhan Xusheng
2026-09-18 17:34 ` Hui Su
2026-09-22  3:30 ` John Stultz
2026-09-22  8:17 ` Peter Zijlstra [this message]
2026-09-22  9:15   ` Zhan Xusheng
2026-09-22  9:49     ` Peter Zijlstra
2026-09-22  9:51       ` Peter Zijlstra
2026-09-24  8:44 ` [tip: sched/urgent] sched/core: Account PSI IRQ time to the execution context, not the scheduling context tip-bot2 for Zhan Xusheng

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=20260922081706.GE2009045@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=connoro@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=metin.kaya@arm.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=sh_def@163.com \
    --cc=surenb@google.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=zhanxusheng1024@gmail.com \
    --cc=zhanxusheng@xiaomi.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®