From: Peter Zijlstra Date: Tue, 26 May 2026 09:32:34 +0000 (+0200) Subject: sched: Be more strict about p->is_blocked X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=708024b575b4ea58c5956e7c09f2d2f48facd478;p=thirdparty%2Flinux.git sched: Be more strict about p->is_blocked Upon entry to try_to_block_task(), p->is_blocked should be false. After all, the prior wakeup would have made it so per ttwu_do_wakeup(). Ensure this is the case, rather than clearing it in the path that doesn't set it. Signed-off-by: Peter Zijlstra (Intel) Acked-by: John Stultz Link: https://patch.msgid.link/20260526113322.364017314%40infradead.org --- diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a06d5a57adc85..8b7eb126c254d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6676,8 +6676,9 @@ static bool try_to_block_task(struct rq *rq, struct task_struct *p, { unsigned long task_state = *task_state_p; + WARN_ON_ONCE(p->is_blocked); + if (signal_pending_state(task_state, p)) { - p->is_blocked = 0; WRITE_ONCE(p->__state, TASK_RUNNING); *task_state_p = TASK_RUNNING; clear_task_blocked_on(p, NULL);