linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>
Cc: kosaki.motohiro@jp.fujitsu.com
Subject: [PATCH 07/11] memcg: make mem_cgroup_zone_nr_pages()
Date: Mon,  1 Dec 2008 21:16:48 +0900 (JST)	[thread overview]
Message-ID: <20081201211545.1CDF.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <20081201205810.1CCA.KOSAKI.MOTOHIRO@jp.fujitsu.com>

introduce mem_cgroup_zone_nr_pages().
it is called by zone_nr_pages() helper function.


this patch doesn't have any behavior change.


Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
 include/linux/memcontrol.h |   11 +++++++++++
 mm/memcontrol.c            |   12 +++++++++++-
 mm/vmscan.c                |    3 +++
 3 files changed, 25 insertions(+), 1 deletion(-)

Index: b/include/linux/memcontrol.h
===================================================================
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -92,6 +92,9 @@ extern long mem_cgroup_calc_reclaim(stru
 					int priority, enum lru_list lru);
 int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg,
 				    struct zone *zone);
+unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
+				       struct zone *zone,
+				       enum lru_list lru);
 
 #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
 extern int do_swap_account;
@@ -250,6 +253,14 @@ mem_cgroup_inactive_anon_is_low(struct m
 	return 1;
 }
 
+static inline unsigned long
+mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
+			 enum lru_list lru)
+{
+	return 0;
+}
+
+
 #endif /* CONFIG_CGROUP_MEM_CONT */
 
 #endif /* _LINUX_MEMCONTROL_H */
Index: b/mm/memcontrol.c
===================================================================
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -186,7 +186,6 @@ pcg_default_flags[NR_CHARGE_TYPE] = {
 	0, /* FORCE */
 };
 
-
 /* for encoding cft->private value on file */
 #define _MEM			(0)
 #define _MEMSWAP		(1)
@@ -448,6 +447,17 @@ int mem_cgroup_inactive_anon_is_low(stru
 	return 0;
 }
 
+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 zid = zone_idx(zone);
+	struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid);
+
+	return MEM_CGROUP_ZSTAT(mz, lru);
+}
+
 unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 					struct list_head *dst,
 					unsigned long *scanned, int order,
Index: b/mm/vmscan.c
===================================================================
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -140,6 +140,9 @@ static struct zone_reclaim_stat *get_rec
 static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
 				   enum lru_list lru)
 {
+	if (!scan_global_lru(sc))
+		return mem_cgroup_zone_nr_pages(sc->mem_cgroup, zone, lru);
+
 	return zone_page_state(zone, NR_LRU_BASE + lru);
 }
 


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

  parent reply	other threads:[~2008-12-01 12:16 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 12:10 [PATCH 00/11] memcg: split-lru feature for memcg take2 KOSAKI Motohiro
2008-12-01 12:11 ` [PATCH 01/11] inactive_anon_is_low() move to vmscan.c KOSAKI Motohiro
2008-12-01 12:12 ` [PATCH 02/11] introduce zone_reclaim struct KOSAKI Motohiro
2008-12-01 12:13 ` [PATCH 03/11] make zone_nr_pages() helper function KOSAKI Motohiro
2008-12-01 12:14 ` [PATCH 04/11] make get_scan_ratio() to memcg safe KOSAKI Motohiro
2008-12-01 14:50   ` Rik van Riel
2008-12-01 12:14 ` [PATCH 05/11] memcg: add null check to page_cgroup_zoneinfo() KOSAKI Motohiro
2008-12-01 14:52   ` Rik van Riel
2008-12-01 12:15 ` [PATCH 06/11] memcg: make inactive_anon_is_low() KOSAKI Motohiro
2008-12-03 13:52   ` Balbir Singh
2008-12-04  6:14     ` KOSAKI Motohiro
2008-12-01 12:16 ` KOSAKI Motohiro [this message]
2008-12-01 16:31   ` [PATCH 07/11] memcg: make mem_cgroup_zone_nr_pages() Rik van Riel
2008-12-03 13:58   ` Balbir Singh
2008-12-01 12:17 ` [PATCH 08/11] memcg: make zone_reclaim_stat KOSAKI Motohiro
2008-12-01 16:33   ` Rik van Riel
2008-12-03 14:06   ` Balbir Singh
2008-12-04  7:15     ` KOSAKI Motohiro
2008-12-01 12:18 ` [PATCH 09/11] memcg: remove mem_cgroup_calc_reclaim() KOSAKI Motohiro
2008-12-01 17:09   ` Rik van Riel
2008-12-01 12:19 ` [PATCH 10/11] memcg: show inactive_ratio KOSAKI Motohiro
2008-12-01 17:10   ` Rik van Riel
2008-12-02  9:05   ` KAMEZAWA Hiroyuki
2008-12-01 12:19 ` [PATCH 11/11] memcg: show reclaim_stat KOSAKI Motohiro
2008-12-01 17:11   ` Rik van Riel
2008-12-02  9:05   ` KAMEZAWA Hiroyuki
2008-12-03 14:19     ` Balbir Singh
2008-12-03 16:15       ` KAMEZAWA Hiroyuki
2008-12-02  4:25 ` [PATCH 00/11] memcg: split-lru feature for memcg take2 KAMEZAWA Hiroyuki

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=20081201211545.1CDF.KOSAKI.MOTOHIRO@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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