Skip to content

Commit 311e062

Browse files
committed
Merge tag 'csd-lock.2024.11.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
Pull CSD-lock update from Paul McKenney: "This switches from sched_clock() to ktime_get_mono_fast_ns(), which on x86 switches from the rdtsc instruction to the rdtscp instruction, thus avoiding instruction reorderings that cause false-positive reports of CSD-lock stalls of almost 2^46 nanoseconds. These false positives are rare, but really are seen in the wild" * tag 'csd-lock.2024.11.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu: locking/csd-lock: Switch from sched_clock() to ktime_get_mono_fast_ns()
2 parents d7d4102 + 9861f7f commit 311e062

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/smp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static bool csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, in
246246
return true;
247247
}
248248

249-
ts2 = sched_clock();
249+
ts2 = ktime_get_mono_fast_ns();
250250
/* How long since we last checked for a stuck CSD lock.*/
251251
ts_delta = ts2 - *ts1;
252252
if (likely(ts_delta <= csd_lock_timeout_ns * (*nmessages + 1) *
@@ -321,7 +321,7 @@ static void __csd_lock_wait(call_single_data_t *csd)
321321
int bug_id = 0;
322322
u64 ts0, ts1;
323323

324-
ts1 = ts0 = sched_clock();
324+
ts1 = ts0 = ktime_get_mono_fast_ns();
325325
for (;;) {
326326
if (csd_lock_wait_toolong(csd, ts0, &ts1, &bug_id, &nmessages))
327327
break;

0 commit comments

Comments
 (0)