From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"yamamoto@valinux.co.jp" <yamamoto@valinux.co.jp>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"containers@lists.osdl.org" <containers@lists.osdl.org>
Subject: [RFC][PATCH] memory controller per zone patches take 2 [5/10] calculate active/inactive balance for memory cgroup
Date: Fri, 16 Nov 2007 19:22:27 +0900 [thread overview]
Message-ID: <20071116192227.bbfb43ac.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20071116191107.46dd523a.kamezawa.hiroyu@jp.fujitsu.com>
Define function for determining active/inactive balance in memory
cgroup.
* just use res.usage as total value and assumes total = active + inactive.
* and yes, we can use mem_cgroup_get_all_zonestat(mem, MEM_CGROUP_ZSTAT_ACTIVE)
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
include/linux/memcontrol.h | 8 ++++++++
mm/memcontrol.c | 16 ++++++++++++++++
2 files changed, 24 insertions(+)
Index: linux-2.6.24-rc2-mm1/mm/memcontrol.c
===================================================================
--- linux-2.6.24-rc2-mm1.orig/mm/memcontrol.c
+++ linux-2.6.24-rc2-mm1/mm/memcontrol.c
@@ -435,6 +435,22 @@ int mem_cgroup_calc_mapped_ratio(struct
rss = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_RSS);
return (rss * 100) / total;
}
+/*
+ * Uses mem_cgroup's imbalance instead of zone's lru imbalance.
+ * This will be used for determining whether page out routine try to free
+ * mapped pages or not.
+ */
+int mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem)
+{
+ s64 total, active, inactive;
+
+ /* usage is recorded in bytes */
+ total = mem->res.usage >> PAGE_SHIFT;
+ inactive = mem_cgroup_get_all_zonestat(mem, MEM_CGROUP_ZSTAT_INACTIVE);
+ active = total - inactive;
+
+ return active / (inactive + 1);
+}
unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
struct list_head *dst,
Index: linux-2.6.24-rc2-mm1/include/linux/memcontrol.h
===================================================================
--- linux-2.6.24-rc2-mm1.orig/include/linux/memcontrol.h
+++ linux-2.6.24-rc2-mm1/include/linux/memcontrol.h
@@ -65,6 +65,8 @@ extern void mem_cgroup_page_migration(st
* For memory reclaim.
*/
extern int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem);
+extern int mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem);
+
#else /* CONFIG_CGROUP_MEM_CONT */
@@ -142,6 +144,12 @@ static inline int mem_cgroup_calc_mapped
{
return 0;
}
+
+static inline int mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem)
+{
+ return 0;
+}
+
#endif /* CONFIG_CGROUP_MEM_CONT */
#endif /* _LINUX_MEMCONTROL_H */
--
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>
next prev parent reply other threads:[~2007-11-16 10:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-16 10:11 [RFC][PATCH] memory controller per zone patches take 2 [0/10] introduction KAMEZAWA Hiroyuki
2007-11-16 10:14 ` [RFC][PATCH] memory controller per zone patches take 2 [1/10] add scan_global_lru() macro KAMEZAWA Hiroyuki
2007-11-17 9:03 ` Balbir Singh
2007-11-16 10:16 ` [RFC][PATCH] memory controller per zone patches take 2 [2/10] add nid/zid function for page_cgroup KAMEZAWA Hiroyuki
2007-11-17 9:15 ` Balbir Singh
2007-11-19 1:37 ` KAMEZAWA Hiroyuki
2007-11-16 10:17 ` [RFC][PATCH] memory controller per zone patches take 2 [3/10] add per zone active/inactive counter to mem_cgroup KAMEZAWA Hiroyuki
2007-11-17 16:07 ` Balbir Singh
2007-11-16 10:18 ` [RFC][PATCH] memory controller per zone patches take 2 [4/10] calculate mapped ratio for memory cgroup KAMEZAWA Hiroyuki
2007-11-17 16:12 ` Balbir Singh
2007-11-19 1:42 ` KAMEZAWA Hiroyuki
2007-11-22 8:34 ` YAMAMOTO Takashi
2007-11-22 8:40 ` KAMEZAWA Hiroyuki
2007-11-22 8:46 ` YAMAMOTO Takashi
2007-11-22 13:31 ` kamezawa.hiroyu
2007-11-16 10:22 ` KAMEZAWA Hiroyuki [this message]
2007-11-16 10:23 ` [RFC][PATCH] memory controller per zone patches take 2 [6/10] remember reclaim priority " KAMEZAWA Hiroyuki
2007-11-16 10:24 ` [RFC][PATCH] memory controller per zone patches take 2 [7/10] calculate reclaim scan number " KAMEZAWA Hiroyuki
2007-11-16 10:25 ` [RFC][PATCH] memory controller per zone patches take 2 [8/10] changes in vmscan.c KAMEZAWA Hiroyuki
2007-11-17 17:37 ` Balbir Singh
2007-11-16 10:26 ` [RFC][PATCH] memory controller per zone patches take 2 [9/10] per-zone-lru for memory cgroup KAMEZAWA Hiroyuki
2007-11-17 17:51 ` Balbir Singh
2007-11-19 1:48 ` KAMEZAWA Hiroyuki
2007-11-19 6:21 ` Balbir Singh
2007-11-19 6:35 ` KAMEZAWA Hiroyuki
2007-11-19 8:34 ` Balbir Singh
2007-11-16 10:27 ` [RFC][PATCH] memory controller per zone patches take 2 [10/10] per-zone-lock " 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=20071116192227.bbfb43ac.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.osdl.org \
--cc=linux-mm@kvack.org \
--cc=yamamoto@valinux.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