Skip to content

Commit c52d8c5

Browse files
committed
sched, psi: Don't account irq time if sched_clock_irqtime is disabled
JIRA: https://issues.redhat.com/browse/RHEL-78821 Conflicts: Context difference in psi_account_irqtime(). commit a6fd161 Author: Yafang Shao <[email protected]> Date: Fri Jan 3 10:24:08 2025 +0800 sched, psi: Don't account irq time if sched_clock_irqtime is disabled sched_clock_irqtime may be disabled due to the clock source. When disabled, irq_time_read() won't change over time, so there is nothing to account. We can save iterating the whole hierarchy on every tick and context switch. Signed-off-by: Yafang Shao <[email protected]> Signed-off-by: Yafang Shao <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Michal Koutný <[email protected]> Acked-by: Johannes Weiner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Phil Auld <[email protected]>
1 parent cb63335 commit c52d8c5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

kernel/sched/psi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ void psi_account_irqtime(struct rq *rq, struct task_struct *curr, struct task_st
999999
u64 now, irq;
10001000
s64 delta;
10011001

1002-
if (static_branch_likely(&psi_disabled))
1002+
if (static_branch_likely(&psi_disabled) || !irqtime_enabled())
10031003
return;
10041004

10051005
if (!curr->pid)
@@ -1241,6 +1241,11 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res)
12411241
if (static_branch_likely(&psi_disabled))
12421242
return -EOPNOTSUPP;
12431243

1244+
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
1245+
if (!irqtime_enabled() && res == PSI_IRQ)
1246+
return -EOPNOTSUPP;
1247+
#endif
1248+
12441249
/* Update averages before reporting them */
12451250
mutex_lock(&group->avgs_lock);
12461251
now = sched_clock();

0 commit comments

Comments
 (0)