tick: Add tick skew boot option
Let the user decide whether power consumption or jitter is the more important consideration for their machines. Quoting removal commitaf5ab277de: "Historically, Linux has tried to make the regular timer tick on the various CPUs not happen at the same time, to avoid contention on xtime_lock. Nowadays, with the tickless kernel, this contention no longer happens since time keeping and updating are done differently. In addition, this skew is actually hurting power consumption in a measurable way on many-core systems." Problems: - Contrary to the above, systems do encounter contention on both xtime_lock and RCU structure locks when the tick is synchronized. - Moderate sized RT systems suffer intolerable jitter due to the tick being synchronized. - SGI reports the same for their large systems. - Fully utilized systems reap no power saving benefit from skew removal, but do suffer from resulting induced lock contention. -0209f649rcu: limit rcu_node leaf-level fanout This patch was born to combat lock contention which testing showed to have been _induced by_ skew removal. Skew the tick, contention disappeared virtually completely. Signed-off-by: Mike Galbraith <mgalbraith@suse.de> Link: http://lkml.kernel.org/r/1336472458.21924.78.camel@marge.simpson.net Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
committed by
Thomas Gleixner
parent
ce004178be
commit
5307c9556b
@@ -814,6 +814,8 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
|
||||
return HRTIMER_RESTART;
|
||||
}
|
||||
|
||||
static int sched_skew_tick;
|
||||
|
||||
/**
|
||||
* tick_setup_sched_timer - setup the tick emulation timer
|
||||
*/
|
||||
@@ -831,6 +833,14 @@ void tick_setup_sched_timer(void)
|
||||
/* Get the next period (per cpu) */
|
||||
hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update());
|
||||
|
||||
/* Offset the tick to avert xtime_lock contention. */
|
||||
if (sched_skew_tick) {
|
||||
u64 offset = ktime_to_ns(tick_period) >> 1;
|
||||
do_div(offset, num_possible_cpus());
|
||||
offset *= smp_processor_id();
|
||||
hrtimer_add_expires_ns(&ts->sched_timer, offset);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
hrtimer_forward(&ts->sched_timer, now, tick_period);
|
||||
hrtimer_start_expires(&ts->sched_timer,
|
||||
@@ -910,3 +920,11 @@ int tick_check_oneshot_change(int allow_nohz)
|
||||
tick_nohz_switch_to_nohz();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init skew_tick(char *str)
|
||||
{
|
||||
get_option(&str, &sched_skew_tick);
|
||||
|
||||
return 0;
|
||||
}
|
||||
early_param("skew_tick", skew_tick);
|
||||
|
||||
Reference in New Issue
Block a user