mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 13:52:50 +01:00
lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed
is_percpu_thread() more elegantly handles SMP vs UP, and further checks the presence of PF_NO_SETAFFINITY. This lets us catch cases where check_preemption_disabled() can race with a concurrent sched_setaffinity(). Signed-off-by: Yejune Deng <[email protected]> [Amended changelog] Signed-off-by: Valentin Schneider <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
This commit is contained in:
1 parent
00b89fe019
commit
570a752b7a
1 file changed
+1
-5
@@ -19,11 +19,7 @@ unsigned int check_preemption_disabled(const char *what1, const char *what2)
|
||||
if (irqs_disabled())
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Kernel threads bound to a single CPU can safely use
|
||||
* smp_processor_id():
|
||||
*/
|
||||
if (current->nr_cpus_allowed == 1)
|
||||
if (is_percpu_thread())
|
||||
goto out;
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
Reference in new issue
Block a user