[PATCH v2] timers: Clear pending_map on CPU hotplug
From: Liang Hao
Date: Wed Sep 30 2026 - 02:36:59 EST
CPU hotplug migration leaves pending_map bits set on the outgoing CPU
while its wheel vectors are empty. After re-online, a later next_expiry
recalc can treat those empty buckets as pending and temporarily pull
next_expiry forward until collect drains the bits.
Clear pending_map under the base lock after migration in
timers_dead_cpu().
Signed-off-by: Liang Hao <haohlliang@xxxxxxxxx>
---
v1 -> v2:
- remove redundant clear in timers_prepare_cpu()
kernel/time/timer.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 42afdcb229d8..a3c4e20a4e36 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -44,6 +44,7 @@
#include <linux/compat.h>
#include <linux/random.h>
#include <linux/sysctl.h>
+#include <linux/bitmap.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
@@ -2541,6 +2542,7 @@ int timers_dead_cpu(unsigned int cpu)
for (i = 0; i < WHEEL_SIZE; i++)
migrate_timer_list(new_base, old_base->vectors + i);
+ bitmap_zero(old_base->pending_map, WHEEL_SIZE);
raw_spin_unlock(&old_base->lock);
raw_spin_unlock_irq(&new_base->lock);
put_cpu_ptr(&timer_bases);
--
2.54.0 (Apple Git-157)