From b46883305f26188bf0555d06e77f43ab01d5ec95 Mon Sep 17 00:00:00 2001 From: Chuyi Zhou Date: Thu, 9 Jul 2026 20:29:20 +0800 Subject: [PATCH] smp: Disable preemption explicitly in __csd_lock_wait() The CSD lock wait debugging code in __csd_lock_wait() must run with preemption disabled. The smp function call mechanisms which invoke it currently keep preemption disabled across the wait, so the debugging code inherits that guarantee from its callers. Keeping preemption disabled across the whole smp function call operation can induce large scheduling latencies. Shortening the caller-side preemption-disabled region would invoke __csd_lock_wait() with preemption enabled. Prepare for that by disabling preemption explicitly around the CSD lock wait debugging code in __csd_lock_wait(). Signed-off-by: Chuyi Zhou Signed-off-by: Thomas Gleixner Tested-by: Paul E. McKenney Reviewed-by: Steven Rostedt (Google) Reviewed-by: Sebastian Andrzej Siewior Acked-by: Muchun Song Link: https://patch.msgid.link/20260709122933.4021501-2-zhouchuyi@bytedance.com --- kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/smp.c b/kernel/smp.c index 8a847a34f132..f5a4d63f3231 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -335,6 +335,8 @@ static void __csd_lock_wait(call_single_data_t *csd) int bug_id = 0; u64 ts0, ts1; + guard(preempt)(); + ts1 = ts0 = ktime_get_mono_fast_ns(); for (;;) { if (csd_lock_wait_toolong(csd, ts0, &ts1, &bug_id, &nmessages))