Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934824Ab1ETDr6 (ORCPT ); Thu, 19 May 2011 23:47:58 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:43621 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933367Ab1ETDr5 (ORCPT ); Thu, 19 May 2011 23:47:57 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Date: Fri, 20 May 2011 12:41:08 +0900 From: KAMEZAWA Hiroyuki To: KAMEZAWA Hiroyuki Cc: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "nishimura@mxp.nes.nec.co.jp" , "balbir@linux.vnet.ibm.com" , Ying Han , hannes@cmpxchg.org, Michal Hocko , "akpm@linux-foundation.org" Subject: [PATCH 1/8] memcg: export zone reclaimable pages Message-Id: <20110520124108.c65e03e3.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <20110520123749.d54b32fa.kamezawa.hiroyu@jp.fujitsu.com> References: <20110520123749.d54b32fa.kamezawa.hiroyu@jp.fujitsu.com> Organization: FUJITSU Co. LTD. X-Mailer: Sylpheed 3.1.0 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2118 Lines: 56 From: Ying Han The number of reclaimable pages per zone is an useful information for controling memory reclaim schedule. This patch exports it. Signed-off-by: Ying Han Signed-off-by: KAMEZAWA Hiroyuki --- include/linux/memcontrol.h | 2 ++ mm/memcontrol.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) Index: mmotm-May11/mm/memcontrol.c =================================================================== --- mmotm-May11.orig/mm/memcontrol.c +++ mmotm-May11/mm/memcontrol.c @@ -1162,6 +1162,20 @@ unsigned long mem_cgroup_zone_nr_pages(s return MEM_CGROUP_ZSTAT(mz, lru); } +unsigned long mem_cgroup_zone_reclaimable_pages(struct mem_cgroup *memcg, + int nid, int zid) +{ + unsigned long nr; + struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid); + + nr = MEM_CGROUP_ZSTAT(mz, NR_ACTIVE_FILE) + + MEM_CGROUP_ZSTAT(mz, NR_ACTIVE_FILE); + if (nr_swap_pages > 0) + nr += MEM_CGROUP_ZSTAT(mz, NR_ACTIVE_ANON) + + MEM_CGROUP_ZSTAT(mz, NR_INACTIVE_ANON); + return nr; +} + struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, struct zone *zone) { Index: mmotm-May11/include/linux/memcontrol.h =================================================================== --- mmotm-May11.orig/include/linux/memcontrol.h +++ mmotm-May11/include/linux/memcontrol.h @@ -108,6 +108,8 @@ extern void mem_cgroup_end_migration(str */ int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg); +unsigned long +mem_cgroup_zone_reclaimable_pages(struct mem_cgroup *memcg, int nid, int zid); int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/