mm/slub.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
From: Xiongwei Song <xiongwei.song@windriver.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@windriver.com>
---
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++;
/*
@@ -4869,11 +4872,6 @@ __kmem_cache_alias(const char *name, unsigned int size, unsigned int align,
*/
s->object_size = max(s->object_size, size);
s->inuse = max(s->inuse, ALIGN(size, sizeof(void *)));
-
- if (sysfs_slab_alias(s, name)) {
- s->refcount--;
- s = NULL;
- }
}
return s;
--
2.30.2
On 5/31/22 02:55, sxwjean@me.com wrote:
> From: Xiongwei Song <xiongwei.song@windriver.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@windriver.com>
Thanks, added to slab/for-5.20/cleanup
> ---
> 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++;
>
> /*
> @@ -4869,11 +4872,6 @@ __kmem_cache_alias(const char *name, unsigned int size, unsigned int align,
> */
> s->object_size = max(s->object_size, size);
> s->inuse = max(s->inuse, ALIGN(size, sizeof(void *)));
> -
> - if (sysfs_slab_alias(s, name)) {
> - s->refcount--;
> - s = NULL;
> - }
> }
>
> return s;
On Tue, May 31, 2022 at 08:55:50AM +0800, sxwjean@me.com wrote: > From: Xiongwei Song <xiongwei.song@windriver.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@windriver.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Thanks.
On Tue, May 31, 2022 at 10:41 AM Muchun Song <songmuchun@bytedance.com> wrote: > > On Tue, May 31, 2022 at 08:55:50AM +0800, sxwjean@me.com wrote: > > From: Xiongwei Song <xiongwei.song@windriver.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@windriver.com> > > Reviewed-by: Muchun Song <songmuchun@bytedance.com> Thanks Muchun. > > Thanks. >
© 2016 - 2026 Red Hat, Inc.