linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ying Han <yinghan@google.com>
To: Michal Hocko <mhocko@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>, Mel Gorman <mel@csn.ul.ie>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>, Greg Thelen <gthelen@google.com>,
	Christoph Lameter <cl@linux.com>,
	KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	Glauber Costa <glommer@parallels.com>
Cc: linux-mm@kvack.org
Subject: [RFC PATCH 2/6] memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control
Date: Thu, 16 Aug 2012 13:53:54 -0700	[thread overview]
Message-ID: <1345150434-30957-1-git-send-email-yinghan@google.com> (raw)

Add target_mem_cgroup and mem_cgroup to shrink_control. The former one is the
"root" memcg under pressure, and the latter one is the "current" memcg under
pressure.

The target_mem_cgroup is initialized with the scan_control's target_mem_cgroup
under target reclaim and default to NULL for rest of the places including
global reclaim.

Signed-off-by: Ying Han <yinghan@google.com>
---
 include/linux/shrinker.h |   10 ++++++++++
 mm/vmscan.c              |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
index d7165ce..d3732d0 100644
--- a/include/linux/shrinker.h
+++ b/include/linux/shrinker.h
@@ -12,6 +12,16 @@ struct shrink_control {
 	unsigned long nr_to_scan;
 
 	int priority;
+	/*
+	 * The memory cgroup that is the primary target of this reclaim. Set to
+	 * NULL during a global reclaim.
+	 */
+	struct mem_cgroup *target_mem_cgroup;
+	/*
+	 * The memory cgroup that is current being scanned in order to reclaim
+	 * from the hierarchy of mem_cgroup.
+	 */
+	struct mem_cgroup *mem_cgroup;
 };
 
 /*
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2c7be04..6ffdff6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2323,6 +2323,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
 	};
 	struct shrink_control shrink = {
 		.gfp_mask = sc.gfp_mask,
+		.target_mem_cgroup = sc.target_mem_cgroup,
 	};
 
 	/*
-- 
1.7.7.3

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

             reply	other threads:[~2012-08-16 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16 20:53 Ying Han [this message]
2012-08-17  5:30 ` [RFC PATCH 2/6] memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control Glauber Costa
2012-08-17  5:41   ` Ying Han

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345150434-30957-1-git-send-email-yinghan@google.com \
    --to=yinghan@google.com \
    --cc=cl@linux.com \
    --cc=glommer@parallels.com \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=mhocko@suse.cz \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).