linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch] mm: memcontrol: default hierarchy interface for memory fix - high reclaim
@ 2015-01-17 15:21 Johannes Weiner
  2015-01-20 13:25 ` Michal Hocko
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Weiner @ 2015-01-17 15:21 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Hocko, Vladimir Davydov, Greg Thelen, linux-mm, cgroups,
	linux-kernel

High limit reclaim can currently overscan in proportion to how many
charges are happening concurrently.  Tone it down such that charges
don't target the entire high-boundary excess, but instead only the
pages they charged themselves when excess is detected.

Reported-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/memcontrol.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 323a01fa1833..7adccee9fecb 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2348,19 +2348,13 @@ done_restock:
 		refill_stock(memcg, batch - nr_pages);
 	/*
 	 * If the hierarchy is above the normal consumption range,
-	 * make the charging task trim the excess.
+	 * make the charging task trim their excess contribution.
 	 */
 	do {
-		unsigned long nr_pages = page_counter_read(&memcg->memory);
-		unsigned long high = ACCESS_ONCE(memcg->high);
-
-		if (nr_pages > high) {
-			mem_cgroup_events(memcg, MEMCG_HIGH, 1);
-
-			try_to_free_mem_cgroup_pages(memcg, nr_pages - high,
-						     gfp_mask, true);
-		}
-
+		if (page_counter_read(&memcg->memory) <= memcg->high)
+			continue;
+		mem_cgroup_events(memcg, MEMCG_HIGH, 1);
+		try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true);
 	} while ((memcg = parent_mem_cgroup(memcg)));
 done:
 	return ret;
-- 
2.2.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-20 15:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-17 15:21 [patch] mm: memcontrol: default hierarchy interface for memory fix - high reclaim Johannes Weiner
2015-01-20 13:25 ` Michal Hocko
2015-01-20 14:16   ` Johannes Weiner
2015-01-20 14:31     ` Michal Hocko
2015-01-20 15:44       ` Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).