lkml.org 
[lkml]   [2020]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 17/19] mm: memcg/slab: use a single set of kmem_caches for all allocations
From
Date
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;

\
 
 \ /
  Last update: 2020-06-05 18:25    [W:0.138 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site