]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched/debug: Avoid checking in_atomic_preempt_off() twice in schedule_debug()
authorLiming Wu <liming.wu@jaguarmicro.com>
Fri, 25 Aug 2023 02:35:00 +0000 (10:35 +0800)
committerIngo Molnar <mingo@kernel.org>
Fri, 22 Sep 2023 09:50:49 +0000 (11:50 +0200)
in_atomic_preempt_off() already gets called in schedule_debug() once,
which is the only caller of __schedule_bug().

Skip the second call within __schedule_bug(), it should always be true
at this point.

[ mingo: Clarified the changelog. ]

Signed-off-by: Liming Wu <liming.wu@jaguarmicro.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230825023501.1848-1-liming.wu@jaguarmicro.com
kernel/sched/core.c

index 52ceb85b64211e318698360385bce30c316eaf3d..107493469b4e14066af2986fc06c55fe43dcfcb3 100644 (file)
@@ -5899,8 +5899,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
        print_modules();
        if (irqs_disabled())
                print_irqtrace_events(prev);
-       if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)
-           && in_atomic_preempt_off()) {
+       if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)) {
                pr_err("Preemption disabled at:");
                print_ip_sym(KERN_ERR, preempt_disable_ip);
        }