summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2008-07-25 10:47:09 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 19:53:37 +0200
commit508b7be0a5b06b64203512ed9b34191cddc83f56 (patch)
tree48b1be978a74d7c2b333efe8a2d1a1187bfe67f0 /mm
parentmemcg: make global var read_mostly (diff)
downloadlinux-508b7be0a5b06b64203512ed9b34191cddc83f56.tar.xz
linux-508b7be0a5b06b64203512ed9b34191cddc83f56.zip
memcg: avoid unnecessary initialization
* remove over-killing initialization (in fast path) * makeing the condition for PAGE_CGROUP_FLAG_ACTIVE be more obvious. Signed-off-by: KAMEAZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Acked-by: Pavel Emelyanov <xemul@openvz.org> 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.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c52c045f5152..90ccc1326356 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -296,7 +296,7 @@ static void __mem_cgroup_remove_list(struct mem_cgroup_per_zone *mz,
MEM_CGROUP_ZSTAT(mz, MEM_CGROUP_ZSTAT_INACTIVE) -= 1;
mem_cgroup_charge_statistics(pc->mem_cgroup, pc->flags, false);
- list_del_init(&pc->lru);
+ list_del(&pc->lru);
}
static void __mem_cgroup_add_list(struct mem_cgroup_per_zone *mz,
@@ -559,7 +559,7 @@ retry:
}
unlock_page_cgroup(page);
- pc = kmem_cache_zalloc(page_cgroup_cache, gfp_mask);
+ pc = kmem_cache_alloc(page_cgroup_cache, gfp_mask);
if (pc == NULL)
goto err;
@@ -606,9 +606,14 @@ retry:
pc->ref_cnt = 1;
pc->mem_cgroup = mem;
pc->page = page;
- pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
+ /*
+ * If a page is accounted as a page cache, insert to inactive list.
+ * If anon, insert to active list.
+ */
if (ctype == MEM_CGROUP_CHARGE_TYPE_CACHE)
pc->flags = PAGE_CGROUP_FLAG_CACHE;
+ else
+ pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
lock_page_cgroup(page);
if (page_get_page_cgroup(page)) {