aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/tick-common.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-05-08 03:30:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:10 -0400
commitd3ed782458f315c30ea679b919a2cc59f2b82565 (patch)
treeb87fffc87acf5632566a6384f5c8be8f5c2e03b2 /kernel/time/tick-common.c
parentd5d3b736e3264934ec832a657a9a434b65f3d51f (diff)
highres/dyntick: prevent xtime lock contention
While the !highres/!dyntick code assigns the duty of the do_timer() call to one specific CPU, this was dropped in the highres/dyntick part during development. Steven Rostedt discovered the xtime lock contention on highres/dyntick due to several CPUs trying to update jiffies. Add the single CPU assignement back. In the dyntick case this needs to be handled carefully, as the CPU which has the do_timer() duty must drop the assignement and let it be grabbed by another CPU, which is active. Otherwise the do_timer() calls would not happen during the long sleep. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Steven Rostedt <rostedt@goodmis.org> Acked-by: Mark Lord <mlord@pobox.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/time/tick-common.c')
-rw-r--r--kernel/time/tick-common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index bfda3f7f0716..a96ec9ab3454 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -31,7 +31,7 @@ DEFINE_PER_CPU(struct tick_device, tick_cpu_device);
31 */ 31 */
32ktime_t tick_next_period; 32ktime_t tick_next_period;
33ktime_t tick_period; 33ktime_t tick_period;
34static int tick_do_timer_cpu = -1; 34int tick_do_timer_cpu __read_mostly = -1;
35DEFINE_SPINLOCK(tick_device_lock); 35DEFINE_SPINLOCK(tick_device_lock);
36 36
37/* 37/*
@@ -295,6 +295,12 @@ static void tick_shutdown(unsigned int *cpup)
295 clockevents_exchange_device(dev, NULL); 295 clockevents_exchange_device(dev, NULL);
296 td->evtdev = NULL; 296 td->evtdev = NULL;
297 } 297 }
298 /* Transfer the do_timer job away from this cpu */
299 if (*cpup == tick_do_timer_cpu) {
300 int cpu = first_cpu(cpu_online_map);
301
302 tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu : -1;
303 }
298 spin_unlock_irqrestore(&tick_device_lock, flags); 304 spin_unlock_irqrestore(&tick_device_lock, flags);
299} 305}
300 306