Re: tty crash due to auto-failing vmalloc

From: Michal Hocko
Date: Wed Oct 04 2017 - 04:33:52 EST


On Tue 03-10-17 18:55:04, Johannes Weiner wrote:
[...]
> commit 5d17a73a2ebeb8d1c6924b91e53ab2650fe86ffb
> Author: Michal Hocko <mhocko@xxxxxxxx>
> Date: Fri Feb 24 14:58:53 2017 -0800
>
> vmalloc: back off when the current task is killed
>
> __vmalloc_area_node() allocates pages to cover the requested vmalloc
> size. This can be a lot of memory. If the current task is killed by
> the OOM killer, and thus has an unlimited access to memory reserves, it
> can consume all the memory theoretically. Fix this by checking for
> fatal_signal_pending and back off early.
>
> Link: http://lkml.kernel.org/r/20170201092706.9966-4-mhocko@xxxxxxxxxx
> Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
>
> This talks about the oom killer and memory exhaustion, but most fatal
> signals don't happen due to the OOM killer.

Now that we have cd04ae1e2dc8 ("mm, oom: do not rely on TIF_MEMDIE for
memory reserves access") the risk of the memory depletion is much
smaller so reverting the above commit should be acceptable. On the other
hand the failure is still possible and the caller should be prepared for
that.
--
Michal Hocko
SUSE Labs