summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c10
-rw-r--r--mm/oom_kill.c9
2 files changed, 12 insertions, 7 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f6cdbf755ed3..2fadd4896a14 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -170,6 +170,16 @@ static void __mem_cgroup_move_lists(struct page_cgroup *pc, bool active)
list_move(&pc->lru, &pc->mem_cgroup->inactive_list);
}
+int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
+{
+ int ret;
+
+ task_lock(task);
+ ret = task->mm && mm_cgroup(task->mm) == mem;
+ task_unlock(task);
+ return ret;
+}
+
/*
* This routine assumes that the appropriate zone's lru lock is already held
*/
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 64751dc9d997..ef5084dbc793 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