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

Configure Feed

Select the types of activity you want to include in your feed.

tick/nohz: Don't shutdown the lowres tick from itself

In lowres dynticks mode, just like in highres dynticks mode, when there
is no tick to program in the future, the tick eventually gets
deactivated either:

* From the idle loop if in idle mode.
* From the IRQ exit if in full dynticks mode.

Therefore there is no need to deactivate it from the tick itself. This
just just brings more overhead in the idle tick path for no reason.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Link: https://lore.kernel.org/r/20230912104406.312185-4-frederic@kernel.org

authored by

Frederic Weisbecker and committed by
Thomas Gleixner
4f7f4409 822deeed

+13 -11
+13 -11
kernel/time/tick-sched.c
··· 1403 1403 tick_sched_do_timer(ts, now); 1404 1404 tick_sched_handle(ts, regs); 1405 1405 1406 - if (unlikely(ts->tick_stopped)) { 1407 - /* 1408 - * The clockevent device is not reprogrammed, so change the 1409 - * clock event device to ONESHOT_STOPPED to avoid spurious 1410 - * interrupts on devices which might not be truly one shot. 1411 - */ 1412 - tick_program_event(KTIME_MAX, 1); 1413 - return; 1406 + /* 1407 + * In dynticks mode, tick reprogram is deferred: 1408 + * - to the idle task if in dynticks-idle 1409 + * - to IRQ exit if in full-dynticks. 1410 + */ 1411 + if (likely(!ts->tick_stopped)) { 1412 + hrtimer_forward(&ts->sched_timer, now, TICK_NSEC); 1413 + tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1); 1414 1414 } 1415 1415 1416 - hrtimer_forward(&ts->sched_timer, now, TICK_NSEC); 1417 - tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1); 1418 1416 } 1419 1417 1420 1418 static inline void tick_nohz_activate(struct tick_sched *ts, int mode) ··· 1517 1519 else 1518 1520 ts->next_tick = 0; 1519 1521 1520 - /* No need to reprogram if we are in idle or full dynticks mode */ 1522 + /* 1523 + * In dynticks mode, tick reprogram is deferred: 1524 + * - to the idle task if in dynticks-idle 1525 + * - to IRQ exit if in full-dynticks. 1526 + */ 1521 1527 if (unlikely(ts->tick_stopped)) 1522 1528 return HRTIMER_NORESTART; 1523 1529