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] [day] [month] [year] [list]
Date:   Fri, 5 Jun 2020 11:17:00 -0700
From:   Roman Gushchin <guro@...com>
To:     Vlastimil Babka <vbabka@...e.cz>
CC:     Andrew Morton <akpm@...ux-foundation.org>,
        Christoph Lameter <cl@...ux.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Michal Hocko <mhocko@...nel.org>,
        Shakeel Butt <shakeelb@...gle.com>, <linux-mm@...ck.org>,
        <kernel-team@...com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 17/19] mm: memcg/slab: use a single set of kmem_caches
 for all allocations

On Fri, Jun 05, 2020 at 06:24:33PM +0200, Vlastimil Babka wrote:
> On 5/28/20 12:34 AM, Roman Gushchin wrote:
> > diff --git a/mm/slab.h b/mm/slab.h
> > index c49a863adb63..57b425d623e5 100644
> > --- a/mm/slab.h
> > +++ b/mm/slab.h
> ...
> > @@ -526,8 +430,7 @@ static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)
> >  	 * When kmemcg is not being used, both assignments should return the
> >  	 * same value. but we don't want to pay the assignment price in that
> >  	 * case. If it is not compiled in, the compiler should be smart enough
> > -	 * to not do even the assignment. In that case, slab_equal_or_root
> > -	 * will also be a constant.
> > +	 * to not do even the assignment.
> >  	 */
> >  	if (!memcg_kmem_enabled() &&
> 
> Just realized that this test can go away - we don't have to call virt_to_cache()
> due to kmemcg if there is just a single cache.

Good point, will remove it in v6.

Thanks!

> 
> >  	    !IS_ENABLED(CONFIG_SLAB_FREELIST_HARDENED) &&
> > @@ -535,7 +438,7 @@ static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)
> >  		return s;
> >  
> >  	cachep = virt_to_cache(x);
> > -	WARN_ONCE(cachep && !slab_equal_or_root(cachep, s),
> > +	WARN_ONCE(cachep && cachep != s,
> >  		  "%s: Wrong slab cache. %s but object is from %s\n",
> >  		  __func__, s->name, cachep->name);
> >  	return cachep;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ