aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/memcontrol.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7a22b4129211..00bb8a64d028 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1925,19 +1925,18 @@ again:
1925 1925
1926 rcu_read_lock(); 1926 rcu_read_lock();
1927 p = rcu_dereference(mm->owner); 1927 p = rcu_dereference(mm->owner);
1928 VM_BUG_ON(!p);
1929 /* 1928 /*
1930 * because we don't have task_lock(), "p" can exit while 1929 * Because we don't have task_lock(), "p" can exit.
1931 * we're here. In that case, "mem" can point to root 1930 * In that case, "mem" can point to root or p can be NULL with
1932 * cgroup but never be NULL. (and task_struct itself is freed 1931 * race with swapoff. Then, we have small risk of mis-accouning.
1933 * by RCU, cgroup itself is RCU safe.) Then, we have small 1932 * But such kind of mis-account by race always happens because
1934 * risk here to get wrong cgroup. But such kind of mis-account 1933 * we don't have cgroup_mutex(). It's overkill and we allo that
1935 * by race always happens because we don't have cgroup_mutex(). 1934 * small race, here.
1936 * It's overkill and we allow that small race, here. 1935 * (*) swapoff at el will charge against mm-struct not against
1936 * task-struct. So, mm->owner can be NULL.
1937 */ 1937 */
1938 mem = mem_cgroup_from_task(p); 1938 mem = mem_cgroup_from_task(p);
1939 VM_BUG_ON(!mem); 1939 if (!mem || mem_cgroup_is_root(mem)) {
1940 if (mem_cgroup_is_root(mem)) {
1941 rcu_read_unlock(); 1940 rcu_read_unlock();
1942 goto done; 1941 goto done;
1943 } 1942 }