mm, memcg: bypass high reclaim iteration for cgroup hierarchy root
authorChris Down <chris@chrisdown.name>
Tue, 7 Apr 2020 03:03:30 +0000 (20:03 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2020 17:43:37 +0000 (10:43 -0700)
The root of the hierarchy cannot have high set, so we will never reclaim
based on it.  This makes that clearer and avoids another entry.

Signed-off-by: Chris Down <chris@chrisdown.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Michal Hocko <mhocko@kernel.org>
Link: http://lkml.kernel.org/r/20200312164137.GA1753625@chrisdown.name
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c

index ca194864d8028b835e425f32a03e156f1fe9c2a6..9965a77d53e5bf06c1a2140c3002da9cf634fa69 100644 (file)
@@ -2254,7 +2254,8 @@ static void reclaim_high(struct mem_cgroup *memcg,
                        continue;
                memcg_memory_event(memcg, MEMCG_HIGH);
                try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true);
-       } while ((memcg = parent_mem_cgroup(memcg)));
+       } while ((memcg = parent_mem_cgroup(memcg)) &&
+                !mem_cgroup_is_root(memcg));
 }
 
 static void high_work_func(struct work_struct *work)