summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuyi Zhou <zhouchuyi@bytedance.com>2026-07-09 20:29:20 +0800
committerThomas Gleixner <tglx@kernel.org>2026-07-16 09:24:55 +0200
commitb46883305f26188bf0555d06e77f43ab01d5ec95 (patch)
tree524b090512830d48b7d0eeed2f4c53ec5d012636
parentaeec9d9ae6143db48a01d8acc64c940b4e65d762 (diff)
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 <zhouchuyi@bytedance.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Tested-by: Paul E. McKenney <paulmck@kernel.org> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Muchun Song <muchun.song@linux.dev> Link: https://patch.msgid.link/20260709122933.4021501-2-zhouchuyi@bytedance.com
-rw-r--r--kernel/smp.c2
1 files changed, 2 insertions, 0 deletions
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))