Skip to content

Commit fdf756f

Browse files
author
Peter Zijlstra
committedSep 30, 2022
sched: Fix more TASK_state comparisons
Boris reported hung_task splats after commit 5aec788 ("sched: Fix TASK_state comparisons"). Upon closer consideration of that change it doesn't only exclude TASK_KILLABLE, but also TASK_IDLE. Update the comment to reflect this fact and add an additional TASK_NOLOAD test to exclude them. Additionally, remove the TASK_FREEZABLE early exit from check_hung_task(), a freezable task is not a frozen task. Fixes: 5aec788 ("sched: Fix TASK_state comparisons") Reported-by: Borislav Petkov <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Borislav Petkov <[email protected]>
1 parent 5aec788 commit fdf756f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎kernel/hung_task.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
9595
* Ensure the task is not frozen.
9696
* Also, skip vfork and any other user process that freezer should skip.
9797
*/
98-
if (unlikely(READ_ONCE(t->__state) & (TASK_FREEZABLE | TASK_FROZEN)))
98+
if (unlikely(READ_ONCE(t->__state) & TASK_FROZEN))
9999
return;
100100

101101
/*
@@ -200,10 +200,14 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
200200
goto unlock;
201201
last_break = jiffies;
202202
}
203-
/* skip the TASK_KILLABLE tasks -- these can be killed */
203+
/*
204+
* skip the TASK_KILLABLE tasks -- these can be killed
205+
* skip the TASK_IDLE tasks -- those are genuinely idle
206+
*/
204207
state = READ_ONCE(t->__state);
205208
if ((state & TASK_UNINTERRUPTIBLE) &&
206-
!(state & TASK_WAKEKILL))
209+
!(state & TASK_WAKEKILL) &&
210+
!(state & TASK_NOLOAD))
207211
check_hung_task(t, timeout);
208212
}
209213
unlock:

0 commit comments

Comments
 (0)