[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d7cdecbc-db24-8ced-1a86-6f4534613763@suse.cz>
Date: Fri, 5 Jun 2020 18:24:33 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Roman Gushchin <guro@...com>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>
Cc: 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 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.
> !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