KOSAKI Motohiro 0753ba01e1 mm: revert "oom: move oom_adj value"
The commit 2ff05b2b (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 commit 2ff05b2b and related commit.

Reverted commit list
---------------------
- commit 2ff05b2b4e (oom: move oom_adj value from task_struct to mm_struct)
- commit 4d8b9135c3 (oom: avoid unnecessary mm locking and scanning for OOM_DISABLE)
- commit 8123681022 (oom: only oom kill exiting tasks with attached memory)
- commit 933b787b57 (mm: copy over oom_adj value at fork time)

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Paul Menage <menage@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-08-18 16:31:13 -07:00
..
2007-10-23 13:47:31 -05:00
2006-11-30 04:58:40 +01:00
2006-10-03 22:54:15 +02:00
2009-06-06 10:28:14 -06:00
2006-10-03 22:47:42 +02:00
2009-03-31 19:44:38 +03:00
2007-10-22 08:13:21 -07:00
2006-12-30 10:56:45 -08:00
2009-05-19 10:23:23 +01:00
2009-05-19 10:23:23 +01:00
2007-07-31 15:39:38 -07:00
2007-05-09 08:58:15 +02:00
2008-09-02 19:21:37 -07:00
2008-07-26 12:00:05 -07:00
2009-08-18 16:31:13 -07:00
2008-04-25 11:56:37 -06:00
2006-11-30 04:58:40 +01:00
2006-12-07 08:39:44 -08:00
2009-05-21 13:14:32 -07:00
2009-01-29 16:34:30 +02:00
2007-02-12 09:48:40 -08:00
2008-11-12 17:17:17 -08:00