Skip to contentSkip to conversation

FAILED: Patch "watchdog/softlockup: fix sample ring index wrap in need_counting_irqs()" failed to apply to 6.12-stable tree

PATCH Sasha Levin 1 participant 1 message Mar 1 Stable branch

lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From cafe4074a7221dca2fa954dd1ab0cf99b6318e23 Mon Sep 17 00:00:00 2001
From: Shengming Hu <[email protected]>
Date: Mon, 19 Jan 2026 21:59:05 +0800
Subject: [PATCH] watchdog/softlockup: fix sample ring index wrap in
need_counting_irqs()

cpustat_tail indexes cpustat_util[], which is a NUM_SAMPLE_PERIODS-sized ring buffer. need_counting_irqs() currently wraps the index using NUM_HARDIRQ_REPORT, which only happens to match NUM_SAMPLE_PERIODS.

Use NUM_SAMPLE_PERIODS for the wrap to keep the ring math correct even if the NUM_HARDIRQ_REPORT or NUM_SAMPLE_PERIODS changes.

Fixes e9a9292e2368 ("watchdog/softlockup: Report the most frequent interrupts")
Cc Ingo Molnar <[email protected]>
Cc Mark Brown <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Zhang Run <[email protected]>
---
 kernel/watchdog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/watchdog.c +1 -1
index b4d5fbdb933a2..7d675781bc917 100644
@@ -550,7 +550,7 @@ static bool need_counting_irqs(void)
 	u8 util;
 	int tail = __this_cpu_read(cpustat_tail);
 
-	tail = (tail + NUM_HARDIRQ_REPORT - 1) % NUM_HARDIRQ_REPORT;
+	tail = (tail + NUM_SAMPLE_PERIODS - 1) % NUM_SAMPLE_PERIODS;
 	util = __this_cpu_read(cpustat_util[tail][STATS_HARDIRQ]);
 	return util > HARDIRQ_PERCENT_THRESH;
 }
Signature · 1 line
2.51.0