linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: balbir@linux.vnet.ibm.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>
Subject: Re: [PATCH] memcg remove warning at DEBUG_VM=off
Date: Fri, 10 Apr 2009 15:33:35 +0900	[thread overview]
Message-ID: <20090410153335.b52c5f74.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20090409222512.bd026a40.akpm@linux-foundation.org>

On Thu, 9 Apr 2009 22:25:12 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 8 Apr 2009 10:57:15 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
> > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-04-08 14:20:42]:
> > 
> > > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > > This is against 2.6.30-rc1. (maybe no problem against mmotm.)
> > > 
> > > ==
> > > Fix warning as
> > > 
> > >   CC      mm/memcontrol.o
> > > mm/memcontrol.c:318: warning: ?$B!Fmem_cgroup_is_obsolete?$B!G defined but not used
> > > 
> > > This is called only from VM_BUG_ON().
> > > 
> > > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > > ---
> > > Index: linux-2.6.30-rc1/mm/memcontrol.c
> > > ===================================================================
> > > --- linux-2.6.30-rc1.orig/mm/memcontrol.c
> > > +++ linux-2.6.30-rc1/mm/memcontrol.c
> > > @@ -314,13 +314,14 @@ static struct mem_cgroup *try_get_mem_cg
> > >  	return mem;
> > >  }
> > > 
> > > +#ifdef CONFIG_DEBUG_VM
> > >  static bool mem_cgroup_is_obsolete(struct mem_cgroup *mem)
> > >  {
> > >  	if (!mem)
> > >  		return true;
> > >  	return css_is_removed(&mem->css);
> > >  }
> > > -
> > > +#endif
> > 
> > Can we change the code to use
> > 
> >         VM_BUG_ON(!mem || css_is_removed(&mem->css));
> > 
> 
> yup.
> 
> --- a/mm/memcontrol.c~memcg-remove-warning-when-config_debug_vm=n-fix
> +++ a/mm/memcontrol.c
> @@ -314,14 +314,13 @@ static struct mem_cgroup *try_get_mem_cg
>  	return mem;
>  }
>  
> -#ifdef CONFIG_DEBUG_VM
>  static bool mem_cgroup_is_obsolete(struct mem_cgroup *mem)
>  {
>  	if (!mem)
>  		return true;
>  	return css_is_removed(&mem->css);
>  }
> -#endif
> +
>  
>  /*
>   * Call callback function against all cgroup under hierarchy tree.
> @@ -933,7 +932,7 @@ static int __mem_cgroup_try_charge(struc
>  	if (unlikely(!mem))
>  		return 0;
>  
> -	VM_BUG_ON(mem_cgroup_is_obsolete(mem));
> +	VM_BUG_ON(!mem || mem_cgroup_is_obsolete(mem));
>  
>  	while (1) {
>  		int ret;
> _
> 
> Although it really should be
> 
> 	VM_BUG_ON(!mem);
> 	VM_BUG_ON(mem_cgroup_is_obsolete(mem));
> 
> because if that BUG triggers, you'll be wondering which case caused it.
> 
Ah, sorry, I missed the reply.
maybe calling css_is_removed() directly is a choice.
I'll prepare v2.

Regards,
-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-04-10  6:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08  5:20 KAMEZAWA Hiroyuki
2009-04-08  5:27 ` Balbir Singh
2009-04-10  5:25   ` Andrew Morton
2009-04-10  6:33     ` KAMEZAWA Hiroyuki [this message]
2009-04-15 10:13       ` Andrea Righi
2009-04-16  0:47         ` KAMEZAWA Hiroyuki
2009-04-16  3:25         ` Balbir Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090410153335.b52c5f74.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox