[patch] mm: memcontrol: do not track soft limit excess on the root level

From: Johannes Weiner
Date: Tue Sep 09 2014 - 09:25:20 EST


Dave encounters res_counter lock contention from memcg_check_events()
when running a multi-threaded page fault benchmark in the root group.

This lock is taken to maintain the tree of soft limit excessors, which
is used by global reclaim to prioritize excess groups. But that makes
no sense on the root level - parent to all other groups, and so all
this overhead is unnecessary. Skip it.

[ The soft limit really shouldn't even be settable on the root level,
but it's been like that forever, so don't risk breaking dopy user
space over this now. ]

Reported-by: Dave Hansen <dave@xxxxxxxx>
Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
---
mm/memcontrol.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 085dc6d2f876..b4de17e4f267 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1013,10 +1013,11 @@ static void memcg_check_events(struct mem_cgroup *memcg, struct page *page)
/* threshold event is triggered in finer grain than soft limit */
if (unlikely(mem_cgroup_event_ratelimit(memcg,
MEM_CGROUP_TARGET_THRESH))) {
- bool do_softlimit;
+ bool do_softlimit = false;
bool do_numainfo __maybe_unused;

- do_softlimit = mem_cgroup_event_ratelimit(memcg,
+ if (!mem_cgroup_is_root(memcg))
+ do_softlimit = mem_cgroup_event_ratelimit(memcg,
MEM_CGROUP_TARGET_SOFTLIMIT);
#if MAX_NUMNODES > 1
do_numainfo = mem_cgroup_event_ratelimit(memcg,
--
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/