Skip to content

Commit 4f7f440

Browse files
Frederic WeisbeckerKAGA-KOKO
authored andcommitted
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Joel Fernandes (Google) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 822deee commit 4f7f440

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

kernel/time/tick-sched.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,18 +1403,16 @@ static void tick_nohz_lowres_handler(struct clock_event_device *dev)
14031403
tick_sched_do_timer(ts, now);
14041404
tick_sched_handle(ts, regs);
14051405

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);
14141414
}
14151415

1416-
hrtimer_forward(&ts->sched_timer, now, TICK_NSEC);
1417-
tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1);
14181416
}
14191417

14201418
static inline void tick_nohz_activate(struct tick_sched *ts, int mode)
@@ -1519,7 +1517,11 @@ static enum hrtimer_restart tick_nohz_highres_handler(struct hrtimer *timer)
15191517
else
15201518
ts->next_tick = 0;
15211519

1522-
/* No need to reprogram if we are in idle or full dynticks mode */
1520+
/*
1521+
* In dynticks mode, tick reprogram is deferred:
1522+
* - to the idle task if in dynticks-idle
1523+
* - to IRQ exit if in full-dynticks.
1524+
*/
15231525
if (unlikely(ts->tick_stopped))
15241526
return HRTIMER_NORESTART;
15251527

0 commit comments

Comments
 (0)