Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation/locking/locktypes: Update migrate_disable() bits.

The initial implementation of migrate_disable() for mainline was a
wrapper around preempt_disable(). RT kernels substituted this with
a real migrate disable implementation.

Later on mainline gained true migrate disable support, but the
documentation was not updated.

Update the documentation, remove the claims about migrate_disable()
mapping to preempt_disable() on non-PREEMPT_RT kernels.

Fixes: 74d862b682f51 ("sched: Make migrate_disable/enable() independent of RT")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211127163200.10466-2-bigeasy@linutronix.de

authored by

Sebastian Andrzej Siewior and committed by
Daniel Borkmann
6a631c04 c0d95d33

+3 -6
+3 -6
Documentation/locking/locktypes.rst
··· 439 439 spin_lock(&p->lock); 440 440 p->count += this_cpu_read(var2); 441 441 442 - On a non-PREEMPT_RT kernel migrate_disable() maps to preempt_disable() 443 - which makes the above code fully equivalent. On a PREEMPT_RT kernel 444 442 migrate_disable() ensures that the task is pinned on the current CPU which 445 443 in turn guarantees that the per-CPU access to var1 and var2 are staying on 446 - the same CPU. 444 + the same CPU while the task remains preemptible. 447 445 448 446 The migrate_disable() substitution is not valid for the following 449 447 scenario:: ··· 454 456 p = this_cpu_ptr(&var1); 455 457 p->val = func2(); 456 458 457 - While correct on a non-PREEMPT_RT kernel, this breaks on PREEMPT_RT because 458 - here migrate_disable() does not protect against reentrancy from a 459 - preempting task. A correct substitution for this case is:: 459 + This breaks because migrate_disable() does not protect against reentrancy from 460 + a preempting task. A correct substitution for this case is:: 460 461 461 462 func() 462 463 {