Re: [PATCH v7] sched/clock: Avoid false sharing for sched_clock_irqtime

From: K Prateek Nayak

Date: Tue Jan 27 2026 - 22:06:46 EST


On 1/28/2026 7:49 AM, Guo, Wangyang wrote:
> Yes, when clock mark unstable through tsc_.*mark_unstable() with non-native_sched_clock, clear_sched_clock_stable won't be called, thus sched_clock_irqtime still keep enabled.
>
> Maybe the dedicated workqueue for sched_clock_irqtime is still needed considering this case.

In that case, shouldn't tsc_init() only enable irqtime when
using_native_sched_clock()? How can tsc_init() make a call on irqtime if
TSC isn't being used as the sched_clock() ultimately?

For kvmclock, if PVCLOCK_TSC_STABLE_BIT is not set, it'll call
clear_sched_clock_stable() at kvm_sched_clock_init() but none of the
other clocksources do so we can assume once we override the sched_clock()
it is up to the sched_clock() provider to deal with the clock stability.

--
Thanks and Regards,
Prateek