Re: [PATCH] oom, oom_reaper: Do not enqueue task if it is on the oom_reaper_list head
From: Tetsuo Handa
Date: Tue Mar 29 2016 - 08:53:41 EST
Michal Hocko wrote:
> From: Michal Hocko <mhocko@xxxxxxxx>
>
> bb29902a7515 ("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.
Indeed, oom_reaper_list is initially NULL.
>
> Fixes: bb29902a7515 ("oom, oom_reaper: protect oom_reaper_list using simpler way")
> Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
Acked-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> ---
> Hi,
> I have just noticed this after I started consolidating other oom_reaper
> related changes I have here locally. I should have caught this during
> the review already and I really feel ashamed I haven't because this is
> really a trivial bug that should be obvious see...