Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hrtimer: Store cpu-number in struct hrtimer_cpu_base

In lowres mode, hrtimers are serviced by the tick instead of a clock
event. Now it works well as long as the tick stays periodic but we
must also make sure that the hrtimers are serviced in dynticks mode.

Part of that job consist in kicking a dynticks hrtimer target in order
to make it reconsider the next tick to schedule to correctly handle the
hrtimer's expiring time. And that part isn't handled by the hrtimers
subsystem.

To prepare for fixing this, we need __hrtimer_start_range_ns() to be
able to resolve the CPU target associated to a hrtimer's object
'cpu_base' so that the kick can be centralized there.

So lets store it in the 'struct hrtimer_cpu_base' to resolve the CPU
without overhead. It is set once at CPU's online notification.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1403393357-2070-4-git-send-email-fweisbec@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Viresh Kumar and committed by
Thomas Gleixner
cddd0248 9f6d9baa

+3
+2
include/linux/hrtimer.h
··· 165 165 * struct hrtimer_cpu_base - the per cpu clock bases 166 166 * @lock: lock protecting the base and associated clock bases 167 167 * and timers 168 + * @cpu: cpu number 168 169 * @active_bases: Bitfield to mark bases with active timers 169 170 * @clock_was_set: Indicates that clock was set from irq context. 170 171 * @expires_next: absolute time of the next event which was scheduled ··· 180 179 */ 181 180 struct hrtimer_cpu_base { 182 181 raw_spinlock_t lock; 182 + unsigned int cpu; 183 183 unsigned int active_bases; 184 184 unsigned int clock_was_set; 185 185 #ifdef CONFIG_HIGH_RES_TIMERS
+1
kernel/time/hrtimer.c
··· 1680 1680 timerqueue_init_head(&cpu_base->clock_base[i].active); 1681 1681 } 1682 1682 1683 + cpu_base->cpu = cpu; 1683 1684 hrtimer_init_hres(cpu_base); 1684 1685 } 1685 1686