All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 2/6] memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control
@ 2012-08-16 20:53 Ying Han
  2012-08-17  5:30 ` Glauber Costa
  0 siblings, 1 reply; 3+ messages in thread
From: Ying Han @ 2012-08-16 20:53 UTC (permalink / raw)
  To: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Greg Thelen, Christoph Lameter, KOSAKI Motohiro,
	Glauber Costa
  Cc: linux-mm

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>

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

* Re: [RFC PATCH 2/6] memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control
  2012-08-16 20:53 [RFC PATCH 2/6] memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control Ying Han
@ 2012-08-17  5:30 ` Glauber Costa
  2012-08-17  5:41   ` Ying Han
  0 siblings, 1 reply; 3+ messages in thread
From: Glauber Costa @ 2012-08-17  5:30 UTC (permalink / raw)
  To: Ying Han
  Cc: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Greg Thelen, Christoph Lameter, KOSAKI Motohiro,
	linux-mm

On 08/17/2012 12:53 AM, Ying Han wrote:
> 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>

Maybe I'll change my mind while I advance in the patchset, but at first,
I don't see the point in having two memcg encoded in the shrinker
structure. It seems to me we should be able to do this internally from
memcg and hide it from the shrinker code.



--
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	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH 2/6] memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control
  2012-08-17  5:30 ` Glauber Costa
@ 2012-08-17  5:41   ` Ying Han
  0 siblings, 0 replies; 3+ messages in thread
From: Ying Han @ 2012-08-17  5:41 UTC (permalink / raw)
  To: Glauber Costa
  Cc: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Greg Thelen, Christoph Lameter, KOSAKI Motohiro,
	linux-mm

On Thu, Aug 16, 2012 at 10:30 PM, Glauber Costa <glommer@parallels.com> wrote:
> On 08/17/2012 12:53 AM, Ying Han wrote:
>> 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>
>
> Maybe I'll change my mind while I advance in the patchset, but at first,
> I don't see the point in having two memcg encoded in the shrinker
> structure. It seems to me we should be able to do this internally from
> memcg and hide it from the shrinker code.

We can do something like scan_control has, and during shrink_zone()
passes down the memcg context with lruvec. That is feasible as
long as it is necessary.

--Ying
>
>
>

--
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	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-17  5:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-16 20:53 [RFC PATCH 2/6] memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control Ying Han
2012-08-17  5:30 ` Glauber Costa
2012-08-17  5:41   ` Ying Han

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.