[tip: sched/core] sched/psi: Bail out early from irq time accounting

From: tip-bot2 for Haifeng Xu
Date: Fri Oct 13 2023 - 04:06:24 EST


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

Commit-ID: 0c2924079f5a83ed715630680e338b3685a0bf7d
Gitweb: https://git.kernel.org/tip/0c2924079f5a83ed715630680e338b3685a0bf7d
Author: Haifeng Xu <haifeng.xu@xxxxxxxxxx>
AuthorDate: Tue, 26 Sep 2023 11:57:22
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Fri, 13 Oct 2023 09:56:29 +02:00

sched/psi: Bail out early from irq time accounting

We could bail out early when psi was disabled.

Signed-off-by: Haifeng Xu <haifeng.xu@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20230926115722.467833-1-haifeng.xu@xxxxxxxxxx
---
kernel/sched/psi.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 44a7877..519bc92 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -998,6 +998,9 @@ void psi_account_irqtime(struct task_struct *task, u32 delta)
struct psi_group_cpu *groupc;
u64 now;

+ if (static_branch_likely(&psi_disabled))
+ return;
+
if (!task->pid)
return;