hrtimer: Store cpu-number in struct hrtimer_cpu_base
authorViresh Kumar <viresh.kumar@linaro.org>
Sat, 21 Jun 2014 23:29:15 +0000 (01:29 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 23 Jun 2014 09:23:47 +0000 (11:23 +0200)
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>
include/linux/hrtimer.h
kernel/time/hrtimer.c

index e7a8d3fa91d574e322a01a4cc1fff3a30a513a15..bb4ffff31c69bdd50b8a66716df6d58d5af76ff6 100644 (file)
@@ -165,6 +165,7 @@ enum  hrtimer_base_type {
  * struct hrtimer_cpu_base - the per cpu clock bases
  * @lock:              lock protecting the base and associated clock bases
  *                     and timers
+ * @cpu:               cpu number
  * @active_bases:      Bitfield to mark bases with active timers
  * @clock_was_set:     Indicates that clock was set from irq context.
  * @expires_next:      absolute time of the next event which was scheduled
@@ -179,6 +180,7 @@ enum  hrtimer_base_type {
  */
 struct hrtimer_cpu_base {
        raw_spinlock_t                  lock;
+       unsigned int                    cpu;
        unsigned int                    active_bases;
        unsigned int                    clock_was_set;
 #ifdef CONFIG_HIGH_RES_TIMERS
index 3ab28993f6e045429f92419e71f8e63a3e1733af..0e32d4e7583fd7337c7fcad586adaee60c77ec1f 100644 (file)
@@ -1680,6 +1680,7 @@ static void init_hrtimers_cpu(int cpu)
                timerqueue_init_head(&cpu_base->clock_base[i].active);
        }
 
+       cpu_base->cpu = cpu;
        hrtimer_init_hres(cpu_base);
 }