Skip to content

Commit af8e15c

Browse files
Michal Hockotorvalds
authored andcommitted
oom, oom_reaper: do not enqueue task if it is on the oom_reaper_list head
Commit bb29902 ("oom, oom_reaper: protect oom_reaper_list using simpler way") has simplified the check for tasks already enqueued for the oom reaper by checking tsk->oom_reaper_list != NULL. This check is not sufficient because the tsk might be the head of the queue without any other tasks queued and then we would simply lockup looping on the same task. Fix the condition by checking for the head as well. Fixes: bb29902 ("oom, oom_reaper: protect oom_reaper_list using simpler way") Signed-off-by: Michal Hocko <mhocko@suse.com> Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent bbe3de2 commit af8e15c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mm/oom_kill.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,11 @@ static int oom_reaper(void *unused)
547547

548548
static void wake_oom_reaper(struct task_struct *tsk)
549549
{
550-
if (!oom_reaper_th || tsk->oom_reaper_list)
550+
if (!oom_reaper_th)
551+
return;
552+
553+
/* tsk is already queued? */
554+
if (tsk == oom_reaper_list || tsk->oom_reaper_list)
551555
return;
552556

553557
get_task_struct(tsk);

0 commit comments

Comments
 (0)