Skip to content

Commit f9fab10

Browse files
Mandeep Singh Bainestorvalds
authored andcommitted
hung_task: fix false positive during vfork
vfork parent uninterruptibly and unkillably waits for its child to exec/exit. This wait is of unbounded length. Ignore such waits in the hung_task detector. Signed-off-by: Mandeep Singh Baines <msb@chromium.org> Reported-by: Sasha Levin <levinsasha928@gmail.com> LKML-Reference: <1325344394.28904.43.camel@lappy> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: John Kacur <jkacur@redhat.com> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 30e0532 commit f9fab10

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎kernel/hung_task.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,17 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
7474

7575
/*
7676
* Ensure the task is not frozen.
77-
* Also, when a freshly created task is scheduled once, changes
78-
* its state to TASK_UNINTERRUPTIBLE without having ever been
79-
* switched out once, it musn't be checked.
77+
* Also, skip vfork and any other user process that freezer should skip.
8078
*/
81-
if (unlikely(t->flags & PF_FROZEN || !switch_count))
79+
if (unlikely(t->flags & (PF_FROZEN | PF_FREEZER_SKIP)))
80+
return;
81+
82+
/*
83+
* When a freshly created task is scheduled once, changes its state to
84+
* TASK_UNINTERRUPTIBLE without having ever been switched out once, it
85+
* musn't be checked.
86+
*/
87+
if (unlikely(!switch_count))
8288
return;
8389

8490
if (switch_count != t->last_switch_count) {

0 commit comments

Comments
 (0)