Commit 570a752b authored by Yejune Deng's avatar Yejune Deng Committed by Peter Zijlstra

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: default avatarYejune Deng <yejune.deng@gmail.com>
[Amended changelog]
Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210510151024.2448573-3-valentin.schneider@arm.com
parent 00b89fe0
...@@ -19,11 +19,7 @@ unsigned int check_preemption_disabled(const char *what1, const char *what2) ...@@ -19,11 +19,7 @@ unsigned int check_preemption_disabled(const char *what1, const char *what2)
if (irqs_disabled()) if (irqs_disabled())
goto out; goto out;
/* if (is_percpu_thread())
* Kernel threads bound to a single CPU can safely use
* smp_processor_id():
*/
if (current->nr_cpus_allowed == 1)
goto out; goto out;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment