lkml.org 
[lkml]   [2022]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] lib/smp_processor_id: use preemptible() macro
preemptible() is unconditional 0 if CONFIG_PREEMPT_COUNT=n, and is
(preempt_count() == 0 && !irqs_disabled()) if CONFIG_PREEMPT_COUNT=y.

Although check_preemption_disabled() depends on CONFIG_PREEMPT_COUNT=y,
the naming implies whether preemption is already disabled. Thus, let's
make check_preemption_disabled() safe even if CONFIG_PREEMPT_COUNT=n.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
lib/smp_processor_id.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index 046ac6297c78..5bb0783ce038 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -13,10 +13,7 @@ unsigned int check_preemption_disabled(const char *what1, const char *what2)
{
int this_cpu = raw_smp_processor_id();

- if (likely(preempt_count()))
- goto out;
-
- if (irqs_disabled())
+ if (likely(!preemptible()))
goto out;

if (is_percpu_thread())
--
2.18.4
\
 
 \ /
  Last update: 2022-06-23 16:19    [W:0.039 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site