lkml.org 
[lkml]   [2013]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] kthread: Make kthread_create() killable.
On Wed, 25 Sep 2013, Tetsuo Handa wrote:

> Any users of wait_for_completion() might be chosen by the OOM killer while
> waiting for completion() call by some process which does memory
> allocation. kthread_create() is one of such users.
>

Any user process callers of wait_for_completion() you mean.

> When such users are chosen by the OOM killer when they are waiting for
> completion() in TASK_UNINTERRUPTIBLE, the system will be kept stressed
> due to memory starvation because the OOM killer cannot kill such users.
>

Also results in a livelock if you're running in a memcg and have hit its
limit.

> Fix this problem for kthreadd by making kthread_create() killable.
>

There appear to be other potential callers of wait_for_completion() in the
tree as well that could be holding lots of memory besides
kthread_create().

Perhaps that's beyond the scope of this particular patch, though.

wait_for_completion() is scary if that completion requires memory that
cannot be allocated because the caller is killed but uninterruptible.

> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Acked-by: David Rientjes <rientjes@google.com>


\
 
 \ /
  Last update: 2013-09-25 23:21    [W:0.040 / U:1.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site