Oleg Nesterov 1cc684ab75 kmod: make __request_module() killable
As Tetsuo Handa pointed out, request_module() can stress the system
while the oom-killed caller sleeps in TASK_UNINTERRUPTIBLE.

The task T uses "almost all" memory, then it does something which
triggers request_module().  Say, it can simply call sys_socket().  This
in turn needs more memory and leads to OOM.  oom-killer correctly
chooses T and kills it, but this can't help because it sleeps in
TASK_UNINTERRUPTIBLE and after that oom-killer becomes "disabled" by the
TIF_MEMDIE task T.

Make __request_module() killable.  The only necessary change is that
call_modprobe() should kmalloc argv and module_name, they can't live in
the stack if we use UMH_KILLABLE.  This memory is freed via
call_usermodehelper_freeinfo()->cleanup.

Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-23 16:58:42 -07:00
..
2012-03-23 09:29:44 -07:00
2011-07-26 16:49:45 -07:00
2012-03-21 10:15:51 -07:00
2011-03-14 09:15:23 -04:00
2011-09-23 12:05:29 +05:30
2012-02-14 10:45:42 +11:00
2011-07-14 12:59:14 +03:00
2012-03-23 16:58:42 -07:00
2012-03-23 16:58:41 -07:00
2011-10-31 17:30:44 -07:00
2011-08-12 16:21:35 -05:00
2012-02-14 10:45:42 +11:00
2011-09-19 17:04:37 -07:00