From 4c4a22148909e4c003562ea7ffe0a06e26919e3c Mon Sep 17 00:00:00 2001 From: David Rientjes Date: Thu, 7 Feb 2008 00:14:06 -0800 Subject: memcontrol: move oom task exclusion to tasklist scan Creates a helper function to return non-zero if a task is a member of a memory controller: int task_in_mem_cgroup(const struct task_struct *task, const struct mem_cgroup *mem); When the OOM killer is constrained by the memory controller, the exclusion of tasks that are not a member of that controller was previously misplaced and appeared in the badness scoring function. It should be excluded during the tasklist scan in select_bad_process() instead. [akpm@linux-foundation.org: build fix] Cc: Christoph Lameter Cc: Balbir Singh Signed-off-by: David Rientjes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/oom_kill.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'mm/oom_kill.c') diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 64751dc..ef5084d 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -65,13 +65,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime, return 0; } -#ifdef CONFIG_CGROUP_MEM_CONT - if (mem != NULL && mm->mem_cgroup != mem) { - task_unlock(p); - return 0; - } -#endif - /* * The memory size of the process is the basis for the badness. */ @@ -223,6 +216,8 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, /* skip the init task */ if (is_global_init(p)) continue; + if (mem && !task_in_mem_cgroup(p, mem)) + continue; /* * This task already has access to memory reserves and is -- cgit v1.1