Commit 7587a4a5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'timers_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Borislav Petkov:

 - Prevent a tick storm when a dedicated timekeeper CPU in nohz_full
   mode runs for prolonged periods with interrupts disabled and ends up
   programming the next tick in the past, leading to that storm

* tag 'timers_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timers/nohz: Last resort update jiffies on nohz_full IRQ entry
parents 1d213767 53e87e3c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -595,7 +595,8 @@ void irq_enter_rcu(void)
{
	__irq_enter_raw();

	if (is_idle_task(current) && (irq_count() == HARDIRQ_OFFSET))
	if (tick_nohz_full_cpu(smp_processor_id()) ||
	    (is_idle_task(current) && (irq_count() == HARDIRQ_OFFSET)))
		tick_irq_enter();

	account_hardirq_enter(current);
+7 −0
Original line number Diff line number Diff line
@@ -1375,6 +1375,13 @@ static inline void tick_nohz_irq_enter(void)
	now = ktime_get();
	if (ts->idle_active)
		tick_nohz_stop_idle(ts, now);
	/*
	 * If all CPUs are idle. We may need to update a stale jiffies value.
	 * Note nohz_full is a special case: a timekeeper is guaranteed to stay
	 * alive but it might be busy looping with interrupts disabled in some
	 * rare case (typically stop machine). So we must make sure we have a
	 * last resort.
	 */
	if (ts->tick_stopped)
		tick_nohz_update_jiffies(now);
}