From: KAMEZAWA Hiroyuki Date: Thu, 7 Feb 2008 08:14:23 +0000 (-0800) Subject: memory cgroup enhancements: remember "a page is on active list of cgroup or not" X-Git-Tag: v2.6.25-rc1~449 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3564c7c45156b358efe921ab2e4e516dad92c94c;p=platform%2Fkernel%2Flinux-stable.git 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 Signed-off-by: YAMAMOTO Takashi Cc: Balbir Singh Cc: Pavel Emelianov Cc: Paul Menage Cc: Peter Zijlstra Cc: "Eric W. Biederman" Cc: Nick Piggin Cc: Kirill Korotaev Cc: Herbert Poetzl Cc: David Rientjes Cc: Vaidyanathan Srinivasan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 11b23f2..31c4f0c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -86,6 +86,7 @@ struct page_cgroup { int flags; }; #define PAGE_CGROUP_FLAG_CACHE (0x1) /* charged as cache */ +#define PAGE_CGROUP_FLAG_ACTIVE (0x2) /* page is active in this cgroup */ enum { MEM_CGROUP_TYPE_UNSPEC = 0, @@ -213,10 +214,13 @@ clear_page_cgroup(struct page *page, struct page_cgroup *pc) static void __mem_cgroup_move_lists(struct page_cgroup *pc, bool active) { - if (active) + if (active) { + pc->flags |= PAGE_CGROUP_FLAG_ACTIVE; list_move(&pc->lru, &pc->mem_cgroup->active_list); - else + } else { + pc->flags &= ~PAGE_CGROUP_FLAG_ACTIVE; list_move(&pc->lru, &pc->mem_cgroup->inactive_list); + } } int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem) @@ -403,7 +407,7 @@ retry: atomic_set(&pc->ref_cnt, 1); pc->mem_cgroup = mem; pc->page = page; - pc->flags = 0; + pc->flags = PAGE_CGROUP_FLAG_ACTIVE; if (ctype == MEM_CGROUP_CHARGE_TYPE_CACHE) pc->flags |= PAGE_CGROUP_FLAG_CACHE;