lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1620458722-13026-1-git-send-email-yejunedeng@gmail.com>
Date:   Sat,  8 May 2021 15:25:22 +0800
From:   Yejune Deng <yejune.deng@...il.com>
To:     peterz@...radead.org, tglx@...utronix.de, bristot@...hat.com,
        valentin.schneider@....com
Cc:     linux-kernel@...r.kernel.org, Yejune Deng <yejunedeng@...il.com>
Subject: [PATCH] lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed

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@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ