[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110520124430.6f463803.kamezawa.hiroyu@jp.fujitsu.com>
Date: Fri, 20 May 2011 12:44:30 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
Ying Han <yinghan@...gle.com>, hannes@...xchg.org,
Michal Hocko <mhocko@...e.cz>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: [PATCH 4/8] memcg: export release victim
Later change will call mem_cgroup_select_victim() from vmscan.c
Need to export an interface and add release_victim().
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
---
include/linux/memcontrol.h | 2 ++
mm/memcontrol.c | 13 +++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
Index: mmotm-May11/mm/memcontrol.c
===================================================================
--- mmotm-May11.orig/mm/memcontrol.c
+++ mmotm-May11/mm/memcontrol.c
@@ -1487,7 +1487,7 @@ u64 mem_cgroup_get_limit(struct mem_cgro
* of the cgroup list, since we track last_scanned_child) of @mem and use
* that to reclaim free pages from.
*/
-static struct mem_cgroup *
+struct mem_cgroup *
mem_cgroup_select_victim(struct mem_cgroup *root_mem)
{
struct mem_cgroup *ret = NULL;
@@ -1519,6 +1519,11 @@ mem_cgroup_select_victim(struct mem_cgro
return ret;
}
+void mem_cgroup_release_victim(struct mem_cgroup *mem)
+{
+ css_put(&mem->css);
+}
+
#if MAX_NUMNODES > 1
/*
@@ -1663,7 +1668,7 @@ static int mem_cgroup_hierarchical_recla
* no reclaimable pages under this hierarchy
*/
if (!check_soft || !total) {
- css_put(&victim->css);
+ mem_cgroup_release_victim(victim);
break;
}
/*
@@ -1674,14 +1679,14 @@ static int mem_cgroup_hierarchical_recla
*/
if (total >= (excess >> 2) ||
(loop > MEM_CGROUP_MAX_RECLAIM_LOOPS)) {
- css_put(&victim->css);
+ mem_cgroup_release_victim(victim);
break;
}
}
}
if (!mem_cgroup_local_usage(victim)) {
/* this cgroup's local usage == 0 */
- css_put(&victim->css);
+ mem_cgroup_release_victim(victim);
continue;
}
/* we use swappiness of local cgroup */
@@ -1694,7 +1699,7 @@ static int mem_cgroup_hierarchical_recla
} else
ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
noswap);
- css_put(&victim->css);
+ mem_cgroup_release_victim(victim);
/*
* At shrinking usage, we can't check we should stop here or
* reclaim more. It's depends on callers. last_scanned_child
Index: mmotm-May11/include/linux/memcontrol.h
===================================================================
--- mmotm-May11.orig/include/linux/memcontrol.h
+++ mmotm-May11/include/linux/memcontrol.h
@@ -122,6 +122,8 @@ struct zone_reclaim_stat*
mem_cgroup_get_reclaim_stat_from_page(struct page *page);
extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
struct task_struct *p);
+struct mem_cgroup *mem_cgroup_select_victim(struct mem_cgroup *mem);
+void mem_cgroup_release_victim(struct mem_cgroup *mem);
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
extern int do_swap_account;
#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists