All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yejune Deng <yejune.deng@gmail.com>
To: peterz@infradead.org, tglx@linutronix.de, bristot@redhat.com,
	valentin.schneider@arm.com
Cc: linux-kernel@vger.kernel.org, Yejune Deng <yejunedeng@gmail.com>
Subject: [PATCH] lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed
Date: Sat,  8 May 2021 15:25:22 +0800	[thread overview]
Message-ID: <1620458722-13026-1-git-send-email-yejunedeng@gmail.com> (raw)

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


             reply	other threads:[~2021-05-08  7:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08  7:25 Yejune Deng [this message]
2021-05-10 10:54 ` [PATCH] lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1620458722-13026-1-git-send-email-yejunedeng@gmail.com \
    --to=yejune.deng@gmail.com \
    --cc=bristot@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=valentin.schneider@arm.com \
    --cc=yejunedeng@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.