public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed
@ 2021-05-08  7:25 Yejune Deng
  2021-05-10 10:54 ` Valentin Schneider
  0 siblings, 1 reply; 4+ messages in thread
From: Yejune Deng @ 2021-05-08  7:25 UTC (permalink / raw)
  To: peterz, tglx, bristot, valentin.schneider; +Cc: linux-kernel, Yejune Deng

Use is_percpu_thread() instead of 'current->nr_cpus_allowed == 1',
is_percpu_thread() is includes boths SMP and SP. It also more readable.
The comments are no needed.

Signed-off-by: Yejune Deng <yejunedeng@gmail.com>
---
 lib/smp_processor_id.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index 1c1dbd3..046ac62 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -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
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-10 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-08  7:25 [PATCH] lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed Yejune Deng
2021-05-10 10:54 ` Valentin Schneider
2021-05-10 13:43   ` [PATCH v2] lib/smp_processor_id: Use is_percpu_thread() check affinity Yejune Deng
2021-05-10 14:36     ` Valentin Schneider

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox