aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/aperfmperf.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2022-04-15 21:19:50 +0200
committerThomas Gleixner <tglx@linutronix.de>2022-04-27 15:51:08 +0200
commit6d108c96bf23598cc3b4f91d60e9b7694abcd2a7 (patch)
tree540dfbe0ed9a54028ec0aadae727686775b1f35d /arch/x86/kernel/cpu/aperfmperf.c
parentdbb5ab6d2c0a7397d77c9f60fe23844d4fe4e634 (diff)
downloadlinux-6d108c96bf23598cc3b4f91d60e9b7694abcd2a7.tar.gz
x86/aperfmperf: Dont wake idle CPUs in arch_freq_get_on_cpu()
aperfmperf_get_khz() already excludes idle CPUs from APERF/MPERF sampling and that's a reasonable decision. There is no point in sending up to two IPIs to an idle CPU just because someone reads a sysfs file. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Paul E. McKenney <paulmck@kernel.org> Link: https://lore.kernel.org/r/20220415161206.419880163@linutronix.de
Diffstat (limited to 'arch/x86/kernel/cpu/aperfmperf.c')
-rw-r--r--arch/x86/kernel/cpu/aperfmperf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/aperfmperf.c b/arch/x86/kernel/cpu/aperfmperf.c
index 9ca008f9e9b1..ea9160f7aaad 100644
--- a/arch/x86/kernel/cpu/aperfmperf.c
+++ b/arch/x86/kernel/cpu/aperfmperf.c
@@ -139,6 +139,9 @@ unsigned int arch_freq_get_on_cpu(int cpu)
if (!housekeeping_cpu(cpu, HK_TYPE_MISC))
return 0;
+ if (rcu_is_idle_cpu(cpu))
+ return 0;
+
if (aperfmperf_snapshot_cpu(cpu, ktime_get(), true))
return per_cpu(samples.khz, cpu);