summaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-08-12 22:31:24 +0200
committerThomas Gleixner <tglx@linutronix.de>2021-08-12 22:34:40 +0200
commit9482fd71dbb8f0d1a61821a83e467dc0a9d7b429 (patch)
tree3b84411e7abe899ca1cfdc42d6117d58cd7aedc7 /kernel/time
parent1e7f7fbcd40c69d23e3fe641ead9f3dc128fa8aa (diff)
downloadlinux-9482fd71dbb8f0d1a61821a83e467dc0a9d7b429.tar.gz
linux-9482fd71dbb8f0d1a61821a83e467dc0a9d7b429.tar.bz2
linux-9482fd71dbb8f0d1a61821a83e467dc0a9d7b429.zip
hrtimer: Use raw_cpu_ptr() in clock_was_set()
clock_was_set() can be invoked from preemptible context. Use raw_cpu_ptr() to check whether high resolution mode is active or not. It does not matter whether the task migrates after acquiring the pointer. Fixes: e71a4153b7c2 ("hrtimer: Force clock_was_set() handling for the HIGHRES=n, NOHZ=y case") Reported-by: Mike Galbraith <efault@gmx.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/875ywacsmb.ffs@tglx
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/hrtimer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 88aefc35f7d2..33b00e213e07 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -944,10 +944,11 @@ static bool update_needs_ipi(struct hrtimer_cpu_base *cpu_base,
*/
void clock_was_set(unsigned int bases)
{
+ struct hrtimer_cpu_base *cpu_base = raw_cpu_ptr(&hrtimer_bases);
cpumask_var_t mask;
int cpu;
- if (!hrtimer_hres_active() && !tick_nohz_active)
+ if (!__hrtimer_hres_active(cpu_base) && !tick_nohz_active)
goto out_timerfd;
if (!zalloc_cpumask_var(&mask, GFP_KERNEL)) {
@@ -958,9 +959,9 @@ void clock_was_set(unsigned int bases)
/* Avoid interrupting CPUs if possible */
cpus_read_lock();
for_each_online_cpu(cpu) {
- struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);
unsigned long flags;
+ cpu_base = &per_cpu(hrtimer_bases, cpu);
raw_spin_lock_irqsave(&cpu_base->lock, flags);
if (update_needs_ipi(cpu_base, bases))