aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2008-02-07 03:14:23 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:20 -0500
commit3564c7c45156b358efe921ab2e4e516dad92c94c (patch)
tree112cf3f5ed5d723620a1ec736f3516d83b4630ac /mm
parent82369553d6d3bc67c54129a02e0bc0b5b88f3045 (diff)
memory cgroup enhancements: remember "a page is on active list of cgroup or not"
Remember page_cgroup is on active_list or not in page_cgroup->flags. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Pavel Emelianov <xemul@openvz.org> Cc: Paul Menage <menage@google.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Kirill Korotaev <dev@sw.ru> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: David Rientjes <rientjes@google.com> Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 11b23f203d68..31c4f0cefdee 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -86,6 +86,7 @@ struct page_cgroup {
86 int flags; 86 int flags;
87}; 87};
88#define PAGE_CGROUP_FLAG_CACHE (0x1) /* charged as cache */ 88#define PAGE_CGROUP_FLAG_CACHE (0x1) /* charged as cache */
89#define PAGE_CGROUP_FLAG_ACTIVE (0x2) /* page is active in this cgroup */
89 90
90enum { 91enum {
91 MEM_CGROUP_TYPE_UNSPEC = 0, 92 MEM_CGROUP_TYPE_UNSPEC = 0,
@@ -213,10 +214,13 @@ clear_page_cgroup(struct page *page, struct page_cgroup *pc)
213 214
214static void __mem_cgroup_move_lists(struct page_cgroup *pc, bool active) 215static void __mem_cgroup_move_lists(struct page_cgroup *pc, bool active)
215{ 216{
216 if (active) 217 if (active) {
218 pc->flags |= PAGE_CGROUP_FLAG_ACTIVE;
217 list_move(&pc->lru, &pc->mem_cgroup->active_list); 219 list_move(&pc->lru, &pc->mem_cgroup->active_list);
218 else 220 } else {
221 pc->flags &= ~PAGE_CGROUP_FLAG_ACTIVE;
219 list_move(&pc->lru, &pc->mem_cgroup->inactive_list); 222 list_move(&pc->lru, &pc->mem_cgroup->inactive_list);
223 }
220} 224}
221 225
222int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem) 226int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
@@ -403,7 +407,7 @@ retry:
403 atomic_set(&pc->ref_cnt, 1); 407 atomic_set(&pc->ref_cnt, 1);
404 pc->mem_cgroup = mem; 408 pc->mem_cgroup = mem;
405 pc->page = page; 409 pc->page = page;
406 pc->flags = 0; 410 pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
407 if (ctype == MEM_CGROUP_CHARGE_TYPE_CACHE) 411 if (ctype == MEM_CGROUP_CHARGE_TYPE_CACHE)
408 pc->flags |= PAGE_CGROUP_FLAG_CACHE; 412 pc->flags |= PAGE_CGROUP_FLAG_CACHE;
409 413