mirror of
https://github.com/torvalds/linux.git
synced 2026-11-25 16:02:57 +00:00
The commit2ff05b2b(oom: move oom_adj value) moveed the oom_adj value to the mm_struct. It was a very good first step for sanitize OOM. However Paul Menage reported the commit makes regression to his job scheduler. Current OOM logic can kill OOM_DISABLED process. Why? His program has the code of similar to the following. ... set_oom_adj(OOM_DISABLE); /* The job scheduler never killed by oom */ ... if (vfork() == 0) { set_oom_adj(0); /* Invoked child can be killed */ execve("foo-bar-cmd"); } .... vfork() parent and child are shared the same mm_struct. then above set_oom_adj(0) doesn't only change oom_adj for vfork() child, it's also change oom_adj for vfork() parent. Then, vfork() parent (job scheduler) lost OOM immune and it was killed. Actually, fork-setting-exec idiom is very frequently used in userland program. We must not break this assumption. Then, this patch revert commit2ff05b2band related commit. Reverted commit list --------------------- - commit2ff05b2b4e(oom: move oom_adj value from task_struct to mm_struct) - commit4d8b9135c3(oom: avoid unnecessary mm locking and scanning for OOM_DISABLE) - commit8123681022(oom: only oom kill exiting tasks with attached memory) - commit933b787b57(mm: copy over oom_adj value at fork time) Signed-off-by: KOSAKI Motohiro <[email protected]> Cc: Paul Menage <[email protected]> Cc: David Rientjes <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Nick Piggin <[email protected]> Cc: Mel Gorman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>