linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"kosaki.motohiro@jp.fujitsu.com" <kosaki.motohiro@jp.fujitsu.com>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>
Subject: [RFC][PATCH 5/8] memcg soft limit (yet another new design) v1
Date: Fri, 27 Mar 2009 14:09:23 +0900	[thread overview]
Message-ID: <20090327140923.7dbbf677.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20090327135933.789729cb.kamezawa.hiroyu@jp.fujitsu.com>

memcg's reclaim routine is designed to ignore locality andplacements and
then, inactive_anon_is_low() function doesn't take "zone" as its argument.

In later soft limit patch, we use "zone" as an arguments.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
Index: mmotm-2.6.29-Mar23/mm/memcontrol.c
===================================================================
--- mmotm-2.6.29-Mar23.orig/mm/memcontrol.c
+++ mmotm-2.6.29-Mar23/mm/memcontrol.c
@@ -561,15 +561,28 @@ void mem_cgroup_record_reclaim_priority(
 	spin_unlock(&mem->reclaim_param_lock);
 }
 
-static int calc_inactive_ratio(struct mem_cgroup *memcg, unsigned long *present_pages)
+static int calc_inactive_ratio(struct mem_cgroup *memcg,
+			       unsigned long *present_pages,
+			       struct zone *z)
 {
 	unsigned long active;
 	unsigned long inactive;
 	unsigned long gb;
 	unsigned long inactive_ratio;
 
-	inactive = mem_cgroup_get_local_zonestat(memcg, LRU_INACTIVE_ANON);
-	active = mem_cgroup_get_local_zonestat(memcg, LRU_ACTIVE_ANON);
+	if (!z) {
+		inactive = mem_cgroup_get_local_zonestat(memcg,
+							 LRU_INACTIVE_ANON);
+		active = mem_cgroup_get_local_zonestat(memcg, LRU_ACTIVE_ANON);
+	} else {
+		int nid = z->zone_pgdat->node_id;
+		int zid = zone_idx(z);
+		struct mem_cgroup_per_zone *mz;
+
+		mz = mem_cgroup_zoneinfo(memcg, nid, zid);
+		inactive = MEM_CGROUP_ZSTAT(mz, LRU_INACTIVE_ANON);
+		active = MEM_CGROUP_ZSTAT(mz, LRU_ACTIVE_ANON);
+	}
 
 	gb = (inactive + active) >> (30 - PAGE_SHIFT);
 	if (gb)
@@ -585,14 +598,14 @@ static int calc_inactive_ratio(struct me
 	return inactive_ratio;
 }
 
-int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
+int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *z)
 {
 	unsigned long active;
 	unsigned long inactive;
 	unsigned long present_pages[2];
 	unsigned long inactive_ratio;
 
-	inactive_ratio = calc_inactive_ratio(memcg, present_pages);
+	inactive_ratio = calc_inactive_ratio(memcg, present_pages, NULL);
 
 	inactive = present_pages[0];
 	active = present_pages[1];
@@ -2337,7 +2350,8 @@ static int mem_control_stat_show(struct 
 
 
 #ifdef CONFIG_DEBUG_VM
-	cb->fill(cb, "inactive_ratio", calc_inactive_ratio(mem_cont, NULL));
+	cb->fill(cb, "inactive_ratio",
+			calc_inactive_ratio(mem_cont, NULL, NULL));
 
 	{
 		int nid, zid;
Index: mmotm-2.6.29-Mar23/include/linux/memcontrol.h
===================================================================
--- mmotm-2.6.29-Mar23.orig/include/linux/memcontrol.h
+++ mmotm-2.6.29-Mar23/include/linux/memcontrol.h
@@ -93,7 +93,7 @@ extern void mem_cgroup_note_reclaim_prio
 							int priority);
 extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
 							int priority);
-int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
+int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *z);
 unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
 				       struct zone *zone,
 				       enum lru_list lru);
@@ -234,7 +234,7 @@ static inline bool mem_cgroup_oom_called
 }
 
 static inline int
-mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
+mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *z)
 {
 	return 1;
 }
Index: mmotm-2.6.29-Mar23/mm/vmscan.c
===================================================================
--- mmotm-2.6.29-Mar23.orig/mm/vmscan.c
+++ mmotm-2.6.29-Mar23/mm/vmscan.c
@@ -1341,7 +1341,7 @@ static int inactive_anon_is_low(struct z
 	if (scanning_global_lru(sc))
 		low = inactive_anon_is_low_global(zone);
 	else
-		low = mem_cgroup_inactive_anon_is_low(sc->mem_cgroup);
+		low = mem_cgroup_inactive_anon_is_low(sc->mem_cgroup, NULL);
 	return low;
 }
 

--
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:[~2009-03-27  5:03 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27  4:59 [RFC][PATCH] " KAMEZAWA Hiroyuki
2009-03-27  5:01 ` [RFC][PATCH 1/8] soft limit support in res_counter KAMEZAWA Hiroyuki
2009-03-27  5:03 ` [RFC][PATCH 2/8] soft limit framework in memcg KAMEZAWA Hiroyuki
2009-03-27  8:01   ` KAMEZAWA Hiroyuki
2009-03-29 17:22   ` Balbir Singh
2009-03-27  5:05 ` [RFC][PATCH 3/8] trigger for updating soft limit information KAMEZAWA Hiroyuki
2009-03-27  5:06 ` [RFC][PATCH 4/8] memcg soft limit priority array queue KAMEZAWA Hiroyuki
2009-03-29 16:56   ` Balbir Singh
2009-03-30 23:58     ` KAMEZAWA Hiroyuki
2009-03-27  5:09 ` KAMEZAWA Hiroyuki [this message]
2009-03-27  5:14   ` [RFC][PATCH 5/8] memcg soft limit (yet another new design) v1 KAMEZAWA Hiroyuki
2009-03-31  8:18   ` KAMEZAWA Hiroyuki
2009-03-27  5:11 ` [RFC][PATCH 6/8] soft limit victim select KAMEZAWA Hiroyuki
2009-03-27  5:12 ` [RFC][PATCH 7/8] memcg soft limit LRU reorder KAMEZAWA Hiroyuki
2009-03-30  7:52   ` Balbir Singh
2009-03-31  0:00     ` KAMEZAWA Hiroyuki
2009-03-31  6:06       ` Balbir Singh
2009-03-31  6:19         ` KAMEZAWA Hiroyuki
2009-03-27  5:13 ` [RFC][PATCH 8/8] extends soft limit event filter KAMEZAWA Hiroyuki
2009-03-28  8:23 ` [RFC][PATCH] memcg soft limit (yet another new design) v1 Balbir Singh
2009-03-28 16:10   ` KAMEZAWA Hiroyuki
2009-03-28 18:11 ` Balbir Singh
2009-03-28 18:27   ` Balbir Singh
2009-03-30 23:55     ` KAMEZAWA Hiroyuki
2009-03-31  5:00       ` Balbir Singh
2009-03-31  5:05         ` KAMEZAWA Hiroyuki
2009-03-31  5:18           ` KAMEZAWA Hiroyuki
2009-03-31  6:10           ` Balbir Singh
2009-03-31  6:28             ` KAMEZAWA Hiroyuki
2009-03-31  6:49               ` Balbir Singh
2009-03-31  6:56                 ` KAMEZAWA Hiroyuki
2009-03-31  6:58                 ` KAMEZAWA Hiroyuki
2009-03-31  0:06     ` KAMEZAWA Hiroyuki
2009-03-31  5:01       ` Balbir Singh
2009-03-31  5:11         ` KAMEZAWA Hiroyuki
2009-03-31  6:07           ` Balbir Singh
2009-03-30 23:54   ` KAMEZAWA Hiroyuki
2009-03-29 13:01 ` Balbir Singh
2009-03-30 23:57   ` KAMEZAWA Hiroyuki
2009-04-01 14:42 ` Balbir Singh
2009-04-01 15:11   ` 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=20090327140923.7dbbf677.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /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