[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YpspHqZM27DeEhNR@n2.us-central1-a.c.spheric-algebra-350919.internal>
Date: Sat, 4 Jun 2022 09:42:54 +0000
From: Hyeonggon Yoo <42.hyeyoo@...il.com>
To: sxwjean@...com
Cc: cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
iamjoonsoo.kim@....com, akpm@...ux-foundation.org, vbabka@...e.cz,
roman.gushchin@...ux.dev, songmuchun@...edance.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Xiongwei Song <xiongwei.song@...driver.com>
Subject: Re: [PATCH v2] mm/slub: Simplify __kmem_cache_alias()
On Fri, Jun 03, 2022 at 10:35:55PM +0800, sxwjean@...com wrote:
> From: Xiongwei Song <xiongwei.song@...driver.com>
>
> There is no need to do anything if sysfs_slab_alias() return nonzero
> value after getting a mergeable cache.
>
> Signed-off-by: Xiongwei Song <xiongwei.song@...driver.com>
> Reviewed-by: Muchun Song <songmuchun@...edance.com>
> ---
> v2: Collect Reviewed-by tag from Muchun.
> ---
> mm/slub.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index d8d5abf49f5f..9444277d669a 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -4861,6 +4861,9 @@ __kmem_cache_alias(const char *name, unsigned int size, unsigned int align,
>
> s = find_mergeable(size, align, flags, name, ctor);
> if (s) {
> + if (sysfs_slab_alias(s, name))
> + return NULL;
> +
> s->refcount++;
>
I think we should not expose sysfs attributes before initializing
what can be read via sysfs attribute (object_size).
> /*
> @@ -4869,11 +4872,6 @@ __kmem_cache_alias(const char *name, unsigned int size, unsigned int align,
> */
> s->object_size = max(s->object_size, size);
this calculation should be done before sysfs_slab_alias().
Thanks,
Hyeonggon
> s->inuse = max(s->inuse, ALIGN(size, sizeof(void *)));
> -
> - if (sysfs_slab_alias(s, name)) {
> - s->refcount--;
> - s = NULL;
> - }
> }
>
> return s;
> --
> 2.30.2
>
Powered by blists - more mailing lists