LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch rfc] memcg: remove NULL check from lookup_page_cgroup() result
@ 2011-02-03 14:12 Johannes Weiner
  2011-02-03 23:59 ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Weiner @ 2011-02-03 14:12 UTC (permalink / raw)
  To: Andrew Morton
  Cc: KAMEZAWA Hiroyuki, Daisuke Nishimura, Balbir Singh, linux-mm,
	linux-kernel

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 <hannes@cmpxchg.org>
---
 mm/memcontrol.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a145c9e..6abaa10 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2343,10 +2343,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)
-- 
1.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch rfc] memcg: remove NULL check from lookup_page_cgroup() result
  2011-02-03 14:12 [patch rfc] memcg: remove NULL check from lookup_page_cgroup() result Johannes Weiner
@ 2011-02-03 23:59 ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-02-03 23:59 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Andrew Morton, Daisuke Nishimura, Balbir Singh, linux-mm, linux-kernel

On Thu, 3 Feb 2011 15:12:30 +0100
Johannes Weiner <hannes@cmpxchg.org> wrote:

> 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 <hannes@cmpxchg.org>

I don't have solid answer to this. If some module use radix-tree and enter pages
to it, mem_cgroup may see it. But..

For my opinion, tring this is good.

Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

> ---
>  mm/memcontrol.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index a145c9e..6abaa10 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2343,10 +2343,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)
> -- 
> 1.7.4
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-04  0:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-03 14:12 [patch rfc] memcg: remove NULL check from lookup_page_cgroup() result Johannes Weiner
2011-02-03 23:59 ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).