Re: [PATCH v5] sched/clock: Avoid false sharing for sched_clock_irqtime
From: K Prateek Nayak
Date: Mon Jan 26 2026 - 22:38:50 EST
Hello Wangyang,
On 1/27/2026 8:46 AM, Wangyang Guo wrote:
> @@ -238,6 +239,8 @@ static int __init sched_clock_init_late(void)
>
> if (__sched_clock_stable_early)
> __set_sched_clock_stable();
> + else
> + disable_sched_clock_irqtime(); /* disable if clock unstable. */
nit. I think we should check for irqtime_enabled() before since
static_key_disable() would grab the cpus_read_lock() unnecessarily even
if irqtime wasn't enabled - possible with PA-RISC where a slow processor
registers the generic sched clock not eabling irqtime and then marks the
sched_clock unstable on SMP which would hit this without having irqtime
enabled.
Same is case with "tsc=noirqtime" and then tsc turns unstable at early
boot.
--
Thanks and Regards,
Prateek