From: Johannes Weiner Date: Wed, 23 Mar 2011 23:42:24 +0000 (-0700) Subject: memcg: remove NULL check from lookup_page_cgroup() result X-Git-Tag: v2.6.39-rc1~163 X-Git-Url: https://git.kernelconcepts.de/?a=commitdiff_plain;h=af4a662144884a7dbb19acbef70878b3b955f928;p=karo-tx-linux.git memcg: remove NULL check from lookup_page_cgroup() result The page_cgroup array is set up before even fork is initialized. I seriously doubt that this code executes before the array is alloc'd. Signed-off-by: Johannes Weiner Acked-by: KAMEZAWA Hiroyuki Cc: Daisuke Nishimura Cc: Balbir Singh Cc: Minchan Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b94cd24c5baa..3a2d54bdf076 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2369,10 +2369,7 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, } pc = lookup_page_cgroup(page); - /* can happen at boot */ - if (unlikely(!pc)) - return 0; - prefetchw(pc); + BUG_ON(!pc); /* XXX: remove this and move pc lookup into commit */ ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, oom, page_size); if (ret || !mem)