mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Zhan Xusheng" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Zhan Xusheng <zhanxusheng@xiaomi.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/urgent] sched/core: Account PSI IRQ time to the execution context, not the scheduling context
Date: Thu, 24 Sep 2026 08:44:46 -0000	[thread overview]
Message-ID: <179023948637.2819794.12313762270570794420.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260918132915.1236312-1-zhanxusheng@xiaomi.com>

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     a0bb6fac53fa7cf1cadb487b43d4c9276a6b82e3
Gitweb:        https://git.kernel.org/tip/a0bb6fac53fa7cf1cadb487b43d4c9276a6b82e3
Author:        Zhan Xusheng <zhanxusheng1024@gmail.com>
AuthorDate:    Fri, 18 Sep 2026 21:29:15 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 24 Sep 2026 10:32:50 +02:00

sched/core: Account PSI IRQ time to the execution context, not the scheduling context

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>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/20260918132915.1236312-1-zhanxusheng@xiaomi.com
---
 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 0b846a1..1fe40de 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5798,7 +5798,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));

      parent reply	other threads:[~2026-09-24  8:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 13:29 [PATCH] sched/core: Account PSI IRQ time to the execution context Zhan Xusheng
2026-09-18 17:34 ` Hui Su
2026-09-22  3:30 ` John Stultz
2026-09-22  8:17 ` Peter Zijlstra
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-bot2 for Zhan Xusheng [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=179023948637.2819794.12313762270570794420.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --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®