[RFC PATCH 1-5] make request_module() killable

From: Oleg Nesterov
Date: Tue Feb 07 2012 - 13:51:07 EST


On 02/07, Oleg Nesterov wrote:
>
> OK. I am convinced we need this ;) Thanks Tetsuo.

So. Please see the attachments. COMPLETELY UNTESTED, only for
review/discussion.

For those who were not CC'ed. As Tetsuo pointed out, request_module()
is very much unfriendly wrt OOM. It needs "a lot" of time/memory to
finish while the caller is blocked in TASK_UNINTERRUPTIBLE.

0001-usermodehelper-kill-umh_wait-renumber-UMH_-consta.patch
0002-usermodehelper-introduce-umh_complete-sub_info.patch
0003-usermodehelper-implement-UMH_KILLABLE.patch

this adds UMH_KILLABLE,

0004-kmod-introduce-call_modprobe-helper.patch
0005-kmod-make-__request_module-killable.patch

this changes __request_module() to use UMH_KILLABLE.

Perhaps we should also mark the modprobe process as OOM_ADJUST_MAX.

What do you all think?

Oleg.

include/linux/kmod.h | 18 ++++-----
kernel/kmod.c | 81 +++++++++++++++++++++++++++++++++++--------
security/keys/request_key.c | 2 +-
3 files changed, 75 insertions(+), 26 deletions(-)