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

tip-bot2 for Haifeng Xu posted 1 patch 2 years, 2 months ago
kernel/sched/psi.c | 3 +++
1 file changed, 3 insertions(+)
[tip: sched/core] sched/psi: Bail out early from irq time accounting
Posted by tip-bot2 for Haifeng Xu 2 years, 2 months ago
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@shopee.com>
AuthorDate:    Tue, 26 Sep 2023 11:57:22 
Committer:     Peter Zijlstra <peterz@infradead.org>
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@shopee.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
Link: https://lore.kernel.org/r/20230926115722.467833-1-haifeng.xu@shopee.com
---
 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;