config SCHED_HRTICK
def_bool HIGH_RES_TIMERS
+
+config TICK_SKEW_LIMIT
+ int
+ default 64
+ help
+ If the kernel is booted on systems with a large number of cpus then the
+ concurrent execution of timer ticks causes long holdoffs due to
+ serialization. Synchrononous executions of interrupts can also cause
+ voltage droop in SOCs. So switch to skewed mode. This mechanism
+ can be overridden by specifying "tick_skew=x" on the kernel command line.
tick_nohz_irq_enter();
}
-static int sched_skew_tick;
+static int sched_skew_tick = -1;
static int __init skew_tick(char *str)
{
{
struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
+ /* Figure out if we should skew the tick */
+ if (sched_skew_tick < 0) {
+ if (num_possible_cpus() >= CONFIG_TICK_SKEW_LIMIT) {
+ sched_skew_tick = 1;
+ pr_info("Tick skewed mode enabled. Possible cpus %u > %u\n",
+ num_possible_cpus(), CONFIG_TICK_SKEW_LIMIT);
+ } else
+ sched_skew_tick = 0;
+ }
+
/* Emulate tick processing via per-CPU hrtimers: */
hrtimer_setup(&ts->sched_timer, tick_nohz_handler, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
do_div(offset, num_possible_cpus());
offset *= smp_processor_id();
hrtimer_add_expires_ns(&ts->sched_timer, offset);
- }
+ } else
+ pr_info("Tick operating in synchronized mode.\n");
+
hrtimer_forward_now(&ts->sched_timer, TICK_NSEC);
if (IS_ENABLED(CONFIG_HIGH_RES_TIMERS) && hrtimer)