linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] memcg: few nit fix and cleanups
@ 2010-07-29  5:25 KOSAKI Motohiro
  2010-07-29  5:26 ` [PATCH 1/5] memcg: sc.nr_to_reclaim should be initialized KOSAKI Motohiro
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-07-29  5:25 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton, KAMEZAWA Hiroyuki,
	Nishimura Daisuke, Balbir Singh
  Cc: kosaki.motohiro


This fixes were a part of memcg tracepoint series. and now It was divided
from such series. All patches are trivial. 



KOSAKI Motohiro (5):
  memcg: sc.nr_to_reclaim should be initialized
  memcg: kill unnecessary initialization
  memcg: mem_cgroup_shrink_node_zone() doesn't need sc.nodemask
  memcg: remove nid and zid argument from mem_cgroup_soft_limit_reclaim()
  memcg: convert to use zone_to_nid() from bare zone->zone_pgdat->node_id

 include/linux/memcontrol.h |    6 +++---
 include/linux/swap.h       |    3 +--
 mm/memcontrol.c            |   14 ++++++--------
 mm/vmscan.c                |   15 ++++-----------
 4 files changed, 14 insertions(+), 24 deletions(-)



--
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] 6+ messages in thread

* [PATCH 1/5] memcg: sc.nr_to_reclaim should be initialized
  2010-07-29  5:25 [PATCH 0/5] memcg: few nit fix and cleanups KOSAKI Motohiro
@ 2010-07-29  5:26 ` KOSAKI Motohiro
  2010-07-29  5:27 ` [PATCH 2/5] memcg: kill unnecessary initialization in mem_cgroup_shrink_node_zone() KOSAKI Motohiro
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-07-29  5:26 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton, KAMEZAWA Hiroyuki,
	Nishimura Daisuke, Balbir Singh
  Cc: kosaki.motohiro

Currently, mem_cgroup_shrink_node_zone() initialize sc.nr_to_reclaim as 0.
It mean shrink_zone() only scan 32 pages and immediately return even if
it doesn't reclaim any pages.

This patch fixes it.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
---
 mm/vmscan.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c691967..224184f 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1935,6 +1935,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
 						struct zone *zone, int nid)
 {
 	struct scan_control sc = {
+		.nr_to_reclaim = SWAP_CLUSTER_MAX,
 		.may_writepage = !laptop_mode,
 		.may_unmap = 1,
 		.may_swap = !noswap,
-- 
1.6.5.2



--
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] 6+ messages in thread

* [PATCH 2/5] memcg: kill unnecessary initialization in mem_cgroup_shrink_node_zone()
  2010-07-29  5:25 [PATCH 0/5] memcg: few nit fix and cleanups KOSAKI Motohiro
  2010-07-29  5:26 ` [PATCH 1/5] memcg: sc.nr_to_reclaim should be initialized KOSAKI Motohiro
@ 2010-07-29  5:27 ` KOSAKI Motohiro
  2010-07-29  5:28 ` [PATCH 3/5] memcg: mem_cgroup_shrink_node_zone() doesn't need sc.nodemask KOSAKI Motohiro
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-07-29  5:27 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton, KAMEZAWA Hiroyuki,
	Nishimura Daisuke, Balbir Singh
  Cc: kosaki.motohiro

sc.nr_reclaimed and sc.nr_scanned have already been initialized
few lines above "struct scan_control sc = {}" statement.

So, This patch remove this unnecessary code.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/vmscan.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 224184f..102ee3a 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1948,8 +1948,6 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
 	sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |
 			(GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK);
 	sc.nodemask = &nm;
-	sc.nr_reclaimed = 0;
-	sc.nr_scanned = 0;
 
 	trace_mm_vmscan_memcg_softlimit_reclaim_begin(0,
 						      sc.may_writepage,
-- 
1.6.5.2



--
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] 6+ messages in thread

* [PATCH 3/5] memcg: mem_cgroup_shrink_node_zone() doesn't need sc.nodemask
  2010-07-29  5:25 [PATCH 0/5] memcg: few nit fix and cleanups KOSAKI Motohiro
  2010-07-29  5:26 ` [PATCH 1/5] memcg: sc.nr_to_reclaim should be initialized KOSAKI Motohiro
  2010-07-29  5:27 ` [PATCH 2/5] memcg: kill unnecessary initialization in mem_cgroup_shrink_node_zone() KOSAKI Motohiro
@ 2010-07-29  5:28 ` KOSAKI Motohiro
  2010-07-29  5:29 ` [PATCH 4/5] memcg: remove nid and zid argument from mem_cgroup_soft_limit_reclaim() KOSAKI Motohiro
  2010-07-29  5:29 ` [PATCH 5/5] memcg: convert to use zone_to_nid() from bare zone->zone_pgdat->node_id KOSAKI Motohiro
  4 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-07-29  5:28 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton, KAMEZAWA Hiroyuki,
	Nishimura Daisuke, Balbir Singh
  Cc: kosaki.motohiro

Currently mem_cgroup_shrink_node_zone() call shrink_zone() directly.
thus it doesn't need to initialize sc.nodemask because shrink_zone()
doesn't use it at all.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
---
 include/linux/swap.h |    3 +--
 mm/memcontrol.c      |    3 +--
 mm/vmscan.c          |    5 +----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index ff4acea..bf4eb62 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -244,8 +244,7 @@ extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
 extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
 						gfp_t gfp_mask, bool noswap,
 						unsigned int swappiness,
-						struct zone *zone,
-						int nid);
+						struct zone *zone);
 extern int __isolate_lru_page(struct page *page, int mode, int file);
 extern unsigned long shrink_all_memory(unsigned long nr_pages);
 extern int vm_swappiness;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2600776..fee5cfa 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1282,8 +1282,7 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
 		/* we use swappiness of local cgroup */
 		if (check_soft)
 			ret = mem_cgroup_shrink_node_zone(victim, gfp_mask,
-				noswap, get_swappiness(victim), zone,
-				zone->zone_pgdat->node_id);
+				noswap, get_swappiness(victim), zone);
 		else
 			ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
 						noswap, get_swappiness(victim));
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 102ee3a..5e37c84 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1932,7 +1932,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
 unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
 						gfp_t gfp_mask, bool noswap,
 						unsigned int swappiness,
-						struct zone *zone, int nid)
+						struct zone *zone)
 {
 	struct scan_control sc = {
 		.nr_to_reclaim = SWAP_CLUSTER_MAX,
@@ -1943,11 +1943,8 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
 		.order = 0,
 		.mem_cgroup = mem,
 	};
-	nodemask_t nm  = nodemask_of_node(nid);
-
 	sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |
 			(GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK);
-	sc.nodemask = &nm;
 
 	trace_mm_vmscan_memcg_softlimit_reclaim_begin(0,
 						      sc.may_writepage,
-- 
1.6.5.2



--
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] 6+ messages in thread

* [PATCH 4/5] memcg: remove nid and zid argument from mem_cgroup_soft_limit_reclaim()
  2010-07-29  5:25 [PATCH 0/5] memcg: few nit fix and cleanups KOSAKI Motohiro
                   ` (2 preceding siblings ...)
  2010-07-29  5:28 ` [PATCH 3/5] memcg: mem_cgroup_shrink_node_zone() doesn't need sc.nodemask KOSAKI Motohiro
@ 2010-07-29  5:29 ` KOSAKI Motohiro
  2010-07-29  5:29 ` [PATCH 5/5] memcg: convert to use zone_to_nid() from bare zone->zone_pgdat->node_id KOSAKI Motohiro
  4 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-07-29  5:29 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton, KAMEZAWA Hiroyuki,
	Nishimura Daisuke, Balbir Singh
  Cc: kosaki.motohiro

mem_cgroup_soft_limit_reclaim() has zone, nid and zid argument. but nid
and zid can be calculated from zone. So remove it.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>

---
 include/linux/memcontrol.h |    6 +++---
 mm/memcontrol.c            |    5 ++---
 mm/vmscan.c                |    7 ++-----
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 9f1afd3..fd8ddbd 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -123,8 +123,8 @@ static inline bool mem_cgroup_disabled(void)
 
 void mem_cgroup_update_file_mapped(struct page *page, int val);
 unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
-						gfp_t gfp_mask, int nid,
-						int zid);
+					    gfp_t gfp_mask);
+
 #else /* CONFIG_CGROUP_MEM_RES_CTLR */
 struct mem_cgroup;
 
@@ -299,7 +299,7 @@ static inline void mem_cgroup_update_file_mapped(struct page *page,
 
 static inline
 unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
-					    gfp_t gfp_mask, int nid, int zid)
+					    gfp_t gfp_mask)
 {
 	return 0;
 }
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index fee5cfa..b9ffc0c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2847,8 +2847,7 @@ static int mem_cgroup_resize_memsw_limit(struct mem_cgroup *memcg,
 }
 
 unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
-						gfp_t gfp_mask, int nid,
-						int zid)
+					    gfp_t gfp_mask)
 {
 	unsigned long nr_reclaimed = 0;
 	struct mem_cgroup_per_zone *mz, *next_mz = NULL;
@@ -2860,7 +2859,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
 	if (order > 0)
 		return 0;
 
-	mctz = soft_limit_tree_node_zone(nid, zid);
+	mctz = soft_limit_tree_node_zone(zone_to_nid(zone), zone_idx(zone));
 	/*
 	 * This loop can run a while, specially if mem_cgroup's continuously
 	 * keep exceeding their soft limit and putting the system under
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5e37c84..6faae10 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2131,7 +2131,6 @@ loop_again:
 		for (i = 0; i <= end_zone; i++) {
 			struct zone *zone = pgdat->node_zones + i;
 			int nr_slab;
-			int nid, zid;
 
 			if (!populated_zone(zone))
 				continue;
@@ -2141,14 +2140,12 @@ loop_again:
 
 			sc.nr_scanned = 0;
 
-			nid = pgdat->node_id;
-			zid = zone_idx(zone);
 			/*
 			 * Call soft limit reclaim before calling shrink_zone.
 			 * For now we ignore the return value
 			 */
-			mem_cgroup_soft_limit_reclaim(zone, order, sc.gfp_mask,
-							nid, zid);
+			mem_cgroup_soft_limit_reclaim(zone, order, sc.gfp_mask);
+
 			/*
 			 * We put equal pressure on every zone, unless one
 			 * zone has way too many pages free already.
-- 
1.6.5.2



--
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] 6+ messages in thread

* [PATCH 5/5] memcg: convert to use zone_to_nid() from bare zone->zone_pgdat->node_id
  2010-07-29  5:25 [PATCH 0/5] memcg: few nit fix and cleanups KOSAKI Motohiro
                   ` (3 preceding siblings ...)
  2010-07-29  5:29 ` [PATCH 4/5] memcg: remove nid and zid argument from mem_cgroup_soft_limit_reclaim() KOSAKI Motohiro
@ 2010-07-29  5:29 ` KOSAKI Motohiro
  4 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-07-29  5:29 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton, KAMEZAWA Hiroyuki,
	Nishimura Daisuke, Balbir Singh
  Cc: kosaki.motohiro


We have zone_to_nid(). this patch convert all existing users of
zone->zone_pgdat->node_id.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
---
 mm/memcontrol.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b9ffc0c..b7bb7d9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -919,7 +919,7 @@ unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
 				       struct zone *zone,
 				       enum lru_list lru)
 {
-	int nid = zone->zone_pgdat->node_id;
+	int nid = zone_to_nid(zone);
 	int zid = zone_idx(zone);
 	struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid);
 
@@ -929,7 +929,7 @@ unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
 struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
 						      struct zone *zone)
 {
-	int nid = zone->zone_pgdat->node_id;
+	int nid = zone_to_nid(zone);
 	int zid = zone_idx(zone);
 	struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid);
 
@@ -974,7 +974,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 	LIST_HEAD(pc_list);
 	struct list_head *src;
 	struct page_cgroup *pc, *tmp;
-	int nid = z->zone_pgdat->node_id;
+	int nid = zone_to_nid(z);
 	int zid = zone_idx(z);
 	struct mem_cgroup_per_zone *mz;
 	int lru = LRU_FILE * file + active;
-- 
1.6.5.2



--
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] 6+ messages in thread

end of thread, other threads:[~2010-07-29  5:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-29  5:25 [PATCH 0/5] memcg: few nit fix and cleanups KOSAKI Motohiro
2010-07-29  5:26 ` [PATCH 1/5] memcg: sc.nr_to_reclaim should be initialized KOSAKI Motohiro
2010-07-29  5:27 ` [PATCH 2/5] memcg: kill unnecessary initialization in mem_cgroup_shrink_node_zone() KOSAKI Motohiro
2010-07-29  5:28 ` [PATCH 3/5] memcg: mem_cgroup_shrink_node_zone() doesn't need sc.nodemask KOSAKI Motohiro
2010-07-29  5:29 ` [PATCH 4/5] memcg: remove nid and zid argument from mem_cgroup_soft_limit_reclaim() KOSAKI Motohiro
2010-07-29  5:29 ` [PATCH 5/5] memcg: convert to use zone_to_nid() from bare zone->zone_pgdat->node_id KOSAKI Motohiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox