Skip to contentSkip to conversation

sched/core: avoid checking in_atomic_preempt_off twice

RFC PATCH Applied [email protected] 2 participants 2 messages Aug 25, 2023 – Sep 22, 2023 Scheduler

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 sched/core: avoid checking in_atomic_preempt_off twice

From: Liming Wu <[email protected]>

in_atomic_preempt_off is checked twice in schedule_debug, and __schedule_bug only called in schedule_debug. remove the redundant in_atomic_preempt_off check in __schedule_bug.

---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +1 -2
index a68d1276bab0..ae44958b3851 100644
@@ -5884,8 +5884,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);
 	}
Signature · 1 line
2.25.1
merge bot Applied
#1 lore raw

[tip: sched/core] sched/debug: Avoid checking in_atomic_preempt_off() twice in schedule_debug()

The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     dc461c48deda8a2d243fbaf49e276d555eb833d8
Gitweb:        https://git.kernel.org/tip/dc461c48deda8a2d243fbaf49e276d555eb833d8
Author:        Liming Wu <[email protected]>
AuthorDate:    Fri, 25 Aug 2023 10:35:00 +08:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Fri, 22 Sep 2023 11:50:49 +02:00

sched/debug: Avoid checking in_atomic_preempt_off() twice in schedule_debug()

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. ]

---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +1 -2
index 52ceb85..1074934 100644
@@ -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);
 	}