linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] mm:memcg: skip memcg of current in mem_cgroup_soft_limit_reclaim
@ 2018-08-03  5:48 Zhaoyang Huang
  2018-08-03  6:11 ` Zhaoyang Huang
  2018-08-03  6:15 ` Michal Hocko
  0 siblings, 2 replies; 6+ messages in thread
From: Zhaoyang Huang @ 2018-08-03  5:48 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar, Johannes Weiner, Michal Hocko,
	Vladimir Davydov, linux-mm, cgroups, linux-kernel,
	kernel-patch-test

for the soft_limit reclaim has more directivity than global reclaim, we
have current memcg be skipped to avoid potential page thrashing.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@spreadtrum.com>
---
 mm/memcontrol.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 8c0280b..9d09e95 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2537,12 +2537,21 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
 			mz = mem_cgroup_largest_soft_limit_node(mctz);
 		if (!mz)
 			break;
-
+		/*
+		 * skip current memcg to avoid page thrashing, for the
+		 * mem_cgroup_soft_reclaim has more directivity than
+		 * global reclaim.
+		 */
+		if (get_mem_cgroup_from_mm(current->mm) == mz->memcg) {
+			reclaimed = 0;
+			goto next;
+		}
 		nr_scanned = 0;
 		reclaimed = mem_cgroup_soft_reclaim(mz->memcg, pgdat,
 						    gfp_mask, &nr_scanned);
 		nr_reclaimed += reclaimed;
 		*total_scanned += nr_scanned;
+next:
 		spin_lock_irq(&mctz->lock);
 		__mem_cgroup_remove_exceeded(mz, mctz);
 
-- 
1.9.1


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

end of thread, other threads:[~2018-08-03  7:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-03  5:48 [PATCH v1] mm:memcg: skip memcg of current in mem_cgroup_soft_limit_reclaim Zhaoyang Huang
2018-08-03  6:11 ` Zhaoyang Huang
2018-08-03  6:18   ` Michal Hocko
2018-08-03  6:59     ` Zhaoyang Huang
2018-08-03  7:07       ` Michal Hocko
2018-08-03  6:15 ` Michal Hocko

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).