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

From: Shrikanth Hegde

Date: Wed Jan 28 2026 - 01:28:35 EST




On 1/28/26 8:35 AM, K Prateek Nayak wrote:
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.


I think this would depend if mark_tsc_unstable happens after system boot,
specially while running kvm guest?