Skip to contentSkip to conversation

sched: panic, when call schedule with preemption disable

PATCH In review YT Chang 2 participants 3 messages Nov 21, 2019 – Nov 26, 2019

Subsystems (2)
lore
Share & tools
lore

YT Chang

author
#0 lore raw

PATCH 1/1 sched: panic, when call schedule with preemption disable

When preemption is disable, call schedule() is incorrect behavior. Suggest to panic directly rather than depend on panic_on_warn.

---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +1 -2
index 7880f4f..214e8d8 100644
@@ -3861,9 +3861,8 @@ static noinline void __schedule_bug(struct task_struct *prev)
 		print_ip_sym(preempt_disable_ip);
 		pr_cont("\n");
 	}
-	if (panic_on_warn)
-		panic("scheduling while atomic\n");
 
+	panic("scheduling while atomic\n");
 	dump_stack();
 	add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
 }
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 2 lines · YT Chang

When preemption is disable, call schedule() is incorrect behavior. Suggest to panic directly rather than depend on panic_on_warn.

Why!?

#2 lore raw
Quoted 5 lines · Peter Zijlstra
Quoted 2 lines · YT Chang

When preemption is disable, call schedule() is incorrect behavior. Suggest to panic directly rather than depend on panic_on_warn.

Why!?

1. Panic directly will easily find the root cause.

Call scheduling in atomic affects not only performance but also
system stability.
ex:
Call scheduling in IRQ will result in IRQ enable after schedule()

2. A lot of warnings depend on panic_on_warn. It is not practical to set panic_on_warn=1.