* [PATCH] mm/slub: Simplify __kmem_cache_alias()
@ 2022-05-31 0:55 sxwjean
2022-05-31 2:41 ` Muchun Song
2022-06-15 7:26 ` Vlastimil Babka
0 siblings, 2 replies; 5+ messages in thread
From: sxwjean @ 2022-05-31 0:55 UTC (permalink / raw)
To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka,
roman.gushchin, 42.hyeyoo
Cc: linux-mm, linux-kernel, Xiongwei Song
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/slub: Simplify __kmem_cache_alias()
2022-05-31 0:55 [PATCH] mm/slub: Simplify __kmem_cache_alias() sxwjean
@ 2022-05-31 2:41 ` Muchun Song
2022-05-31 11:22 ` Xiongwei Song
2022-06-15 7:26 ` Vlastimil Babka
1 sibling, 1 reply; 5+ messages in thread
From: Muchun Song @ 2022-05-31 2:41 UTC (permalink / raw)
To: sxwjean
Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka,
roman.gushchin, 42.hyeyoo, linux-mm, linux-kernel, Xiongwei Song
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/slub: Simplify __kmem_cache_alias()
2022-05-31 2:41 ` Muchun Song
@ 2022-05-31 11:22 ` Xiongwei Song
0 siblings, 0 replies; 5+ messages in thread
From: Xiongwei Song @ 2022-05-31 11:22 UTC (permalink / raw)
To: Muchun Song
Cc: Xiongwei Song, Christoph Lameter, Pekka Enberg, David Rientjes,
Joonsoo Kim, Andrew Morton, Vlastimil Babka, Roman Gushchin,
Hyeonggon Yoo, linux-mm @ kvack . org, Linux Kernel Mailing List,
Xiongwei Song
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.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/slub: Simplify __kmem_cache_alias()
2022-05-31 0:55 [PATCH] mm/slub: Simplify __kmem_cache_alias() sxwjean
2022-05-31 2:41 ` Muchun Song
@ 2022-06-15 7:26 ` Vlastimil Babka
1 sibling, 0 replies; 5+ messages in thread
From: Vlastimil Babka @ 2022-06-15 7:26 UTC (permalink / raw)
To: sxwjean, cl, penberg, rientjes, iamjoonsoo.kim, akpm,
roman.gushchin, 42.hyeyoo
Cc: linux-mm, linux-kernel, Xiongwei Song
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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] mm/slub: Simplify __kmem_cache_alias()
@ 2022-05-31 0:37 Xiongwei Song
0 siblings, 0 replies; 5+ messages in thread
From: Xiongwei Song @ 2022-05-31 0:37 UTC (permalink / raw)
To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka,
roman.gushchin, 42.hyeyoo
Cc: linux-mm, linux-kernel
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.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-06-15 7:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 0:55 [PATCH] mm/slub: Simplify __kmem_cache_alias() sxwjean
2022-05-31 2:41 ` Muchun Song
2022-05-31 11:22 ` Xiongwei Song
2022-06-15 7:26 ` Vlastimil Babka
-- strict thread matches above, loose matches on Subject: below --
2022-05-31 0:37 Xiongwei Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).