Messages in this thread Patch in this message | | | Date | Thu, 23 Jun 2022 23:18:54 +0900 | From | Tetsuo Handa <> | 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
| |