History

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.

Peter Zijlstra committed 5 months ago

Commit 708024b1 parent abc40cc1 file · +2 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sched/core.c+2−1
@@ -6676,8 +6676,9 @@ static bool try_to_block_task(struct rq *rq, struct task_struct *p, · 6675 unmodified lines
6676{6676{
6677 unsigned long task_state = *task_state_p;6677 unsigned long task_state = *task_state_p;
6678 6678
6679 WARN_ON_ONCE(p->is_blocked);
6680
6679 if (signal_pending_state(task_state, p)) {6681 if (signal_pending_state(task_state, p)) {
6680 p->is_blocked = 0;
6681 WRITE_ONCE(p->__state, TASK_RUNNING);6682 WRITE_ONCE(p->__state, TASK_RUNNING);
6682 *task_state_p = TASK_RUNNING;6683 *task_state_p = TASK_RUNNING;
6683 clear_task_blocked_on(p, NULL);6684 clear_task_blocked_on(p, NULL);