lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090410153335.b52c5f74.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Fri, 10 Apr 2009 15:33:35 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	balbir@...ux.vnet.ibm.com,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>
Subject: Re: [PATCH] memcg remove warning at DEBUG_VM=off

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

> On Wed, 8 Apr 2009 10:57:15 +0530 Balbir Singh <balbir@...ux.vnet.ibm.com> wrote:
> 
> > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> [2009-04-08 14:20:42]:
> > 
> > > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...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@...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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ