aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/memcontrol.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2a1f7847b6ad..7bc30707d0c6 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1238,10 +1238,21 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg)
1238 struct task_struct *p; 1238 struct task_struct *p;
1239 1239
1240 p = find_lock_task_mm(task); 1240 p = find_lock_task_mm(task);
1241 if (!p) 1241 if (p) {
1242 return 0; 1242 curr = try_get_mem_cgroup_from_mm(p->mm);
1243 curr = try_get_mem_cgroup_from_mm(p->mm); 1243 task_unlock(p);
1244 task_unlock(p); 1244 } else {
1245 /*
1246 * All threads may have already detached their mm's, but the oom
1247 * killer still needs to detect if they have already been oom
1248 * killed to prevent needlessly killing additional tasks.
1249 */
1250 task_lock(task);
1251 curr = mem_cgroup_from_task(task);
1252 if (curr)
1253 css_get(&curr->css);
1254 task_unlock(task);
1255 }
1245 if (!curr) 1256 if (!curr)
1246 return 0; 1257 return 0;
1247 /* 1258 /*