[PATCH] sched/core: Account PSI IRQ time to the execution context

From: Zhan Xusheng

Date: Fri Sep 18 2026 - 09:38:13 EST


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@xxxxxxxxxx>
---
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));

base-commit: 5dd1818b15d98d4a20806cd00b1b40320b06004f
--
2.43.0