linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Cleanups for slab
@ 2022-03-10 14:06 sxwjean
  2022-03-10 14:07 ` [PATCH v2 1/2] mm: slab: Delete unused SLAB_DEACTIVATED flag sxwjean
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: sxwjean @ 2022-03-10 14:06 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka, longman,
	guro, willy, roman.gushchin
  Cc: linux-mm, linux-kernel, Xiongwei Song

From: Xiongwei Song <sxwjean@gmail.com>

2 cleanups, no functionality changed.

---
Since v2:
 - Add the detailed history of parameter @s of alloc_slab_page(),
   message from Matthew Wilcox.
 - Collect Reviewed-by and Acked-by. Thanks Matthew Wilcox, David Rientjes
   and Roman Gushchin.

Since v1:
 - https://lore.kernel.org/all/20220309145052.219138-1-sxwjean@me.com/
---

Xiongwei Song (2):
  mm: slab: Delete unused SLAB_DEACTIVATED flag
  mm: slub: Delete useless parameter of alloc_slab_page()

 include/linux/slab.h | 3 ---
 mm/slub.c            | 8 ++++----
 2 files changed, 4 insertions(+), 7 deletions(-)

-- 
2.30.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] mm: slab: Delete unused SLAB_DEACTIVATED flag
  2022-03-10 14:06 [PATCH v2 0/2] Cleanups for slab sxwjean
@ 2022-03-10 14:07 ` sxwjean
  2022-03-10 14:27   ` Hyeonggon Yoo
  2022-03-10 14:07 ` [PATCH v2 2/2] mm: slub: Delete useless parameter of alloc_slab_page() sxwjean
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: sxwjean @ 2022-03-10 14:07 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka, longman,
	guro, willy, roman.gushchin
  Cc: linux-mm, linux-kernel, Xiongwei Song

From: Xiongwei Song <sxwjean@gmail.com>

Since commit 9855609bde03 ("mm: memcg/slab: use a single set of
kmem_caches for all accounted allocations") deleted all SLAB_DEACTIVATED
users, therefore this flag is not needed any more, let's delete it.

Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
Acked-by: David Rientjes <rientjes@google.com>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
---
 include/linux/slab.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 37bde99b74af..b6b3eed6c7c4 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -117,9 +117,6 @@
 #define SLAB_RECLAIM_ACCOUNT	((slab_flags_t __force)0x00020000U)
 #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */
 
-/* Slab deactivation flag */
-#define SLAB_DEACTIVATED	((slab_flags_t __force)0x10000000U)
-
 /*
  * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
  *
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] mm: slub: Delete useless parameter of alloc_slab_page()
  2022-03-10 14:06 [PATCH v2 0/2] Cleanups for slab sxwjean
  2022-03-10 14:07 ` [PATCH v2 1/2] mm: slab: Delete unused SLAB_DEACTIVATED flag sxwjean
@ 2022-03-10 14:07 ` sxwjean
  2022-03-10 14:45 ` Hyeonggon Yoo
  2022-03-10 17:20 ` [PATCH v2 0/2] Cleanups for slab Vlastimil Babka
  3 siblings, 0 replies; 6+ messages in thread
From: sxwjean @ 2022-03-10 14:07 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka, longman,
	guro, willy, roman.gushchin
  Cc: linux-mm, linux-kernel, Xiongwei Song

From: Xiongwei Song <sxwjean@gmail.com>

The parameter @s is useless for alloc_slab_page(). It was added in 2014
by commit 5dfb41750992 ("sl[au]b: charge slabs to kmemcg explicitly"). The
need for it was removed in 2020 by commit 1f3147b49d75 ("mm: slub: call
account_slab_page() after slab page initialization"). Let's delete it.

[willy@infradead.org: Added detailed history of @s]
Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: David Rientjes <rientjes@google.com>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
---
 mm/slub.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 261474092e43..5d273ee04c43 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1788,8 +1788,8 @@ static void *setup_object(struct kmem_cache *s, struct slab *slab,
 /*
  * Slab allocation and freeing
  */
-static inline struct slab *alloc_slab_page(struct kmem_cache *s,
-		gfp_t flags, int node, struct kmem_cache_order_objects oo)
+static inline struct slab *alloc_slab_page(gfp_t flags, int node,
+		struct kmem_cache_order_objects oo)
 {
 	struct folio *folio;
 	struct slab *slab;
@@ -1941,7 +1941,7 @@ static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
 	if ((alloc_gfp & __GFP_DIRECT_RECLAIM) && oo_order(oo) > oo_order(s->min))
 		alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~(__GFP_RECLAIM|__GFP_NOFAIL);
 
-	slab = alloc_slab_page(s, alloc_gfp, node, oo);
+	slab = alloc_slab_page(alloc_gfp, node, oo);
 	if (unlikely(!slab)) {
 		oo = s->min;
 		alloc_gfp = flags;
@@ -1949,7 +1949,7 @@ static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
 		 * Allocation may have failed due to fragmentation.
 		 * Try a lower order alloc if possible
 		 */
-		slab = alloc_slab_page(s, alloc_gfp, node, oo);
+		slab = alloc_slab_page(alloc_gfp, node, oo);
 		if (unlikely(!slab))
 			goto out;
 		stat(s, ORDER_FALLBACK);
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] mm: slab: Delete unused SLAB_DEACTIVATED flag
  2022-03-10 14:07 ` [PATCH v2 1/2] mm: slab: Delete unused SLAB_DEACTIVATED flag sxwjean
@ 2022-03-10 14:27   ` Hyeonggon Yoo
  0 siblings, 0 replies; 6+ messages in thread
From: Hyeonggon Yoo @ 2022-03-10 14:27 UTC (permalink / raw)
  To: sxwjean
  Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka, longman,
	guro, willy, roman.gushchin, linux-mm, linux-kernel,
	Xiongwei Song

On Thu, Mar 10, 2022 at 10:07:00PM +0800, sxwjean@me.com wrote:
> From: Xiongwei Song <sxwjean@gmail.com>
> 
> Since commit 9855609bde03 ("mm: memcg/slab: use a single set of
> kmem_caches for all accounted allocations") deleted all SLAB_DEACTIVATED
> users, therefore this flag is not needed any more, let's delete it.
> 

Looks nice!

Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>

> Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
> Acked-by: David Rientjes <rientjes@google.com>
> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
> ---
>  include/linux/slab.h | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 37bde99b74af..b6b3eed6c7c4 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -117,9 +117,6 @@
>  #define SLAB_RECLAIM_ACCOUNT	((slab_flags_t __force)0x00020000U)
>  #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */
>  
> -/* Slab deactivation flag */
> -#define SLAB_DEACTIVATED	((slab_flags_t __force)0x10000000U)
> -
>  /*
>   * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
>   *
> -- 
> 2.30.2
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] mm: slub: Delete useless parameter of alloc_slab_page()
  2022-03-10 14:06 [PATCH v2 0/2] Cleanups for slab sxwjean
  2022-03-10 14:07 ` [PATCH v2 1/2] mm: slab: Delete unused SLAB_DEACTIVATED flag sxwjean
  2022-03-10 14:07 ` [PATCH v2 2/2] mm: slub: Delete useless parameter of alloc_slab_page() sxwjean
@ 2022-03-10 14:45 ` Hyeonggon Yoo
  2022-03-10 17:20 ` [PATCH v2 0/2] Cleanups for slab Vlastimil Babka
  3 siblings, 0 replies; 6+ messages in thread
From: Hyeonggon Yoo @ 2022-03-10 14:45 UTC (permalink / raw)
  To: sxwjean
  Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka, longman,
	guro, willy, roman.gushchin, linux-mm, linux-kernel,
	Xiongwei Song

> From: Xiongwei Song <sxwjean@gmail.com>
>
> The parameter @s is useless for alloc_slab_page(). It was added in 2014
> by commit 5dfb41750992 ("sl[au]b: charge slabs to kmemcg explicitly"). The
> need for it was removed in 2020 by commit 1f3147b49d75 ("mm: slub: call
> account_slab_page() after slab page initialization"). Let's delete it.
>
> [willy@infradead.org: Added detailed history of @s]
> Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Acked-by: David Rientjes <rientjes@google.com>
> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
> ---
> mm/slub.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 261474092e43..5d273ee04c43 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1788,8 +1788,8 @@ static void *setup_object(struct kmem_cache *s, struct slab *slab,
>  /*
>  * Slab allocation and freeing
>  */
> -static inline struct slab *alloc_slab_page(struct kmem_cache *s,
> -		gfp_t flags, int node, struct kmem_cache_order_objects oo)
> +static inline struct slab *alloc_slab_page(gfp_t flags, int node,
> +		struct kmem_cache_order_objects oo)
>  {
>  	struct folio *folio;
> 	struct slab *slab;
> @@ -1941,7 +1941,7 @@ static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> 	if ((alloc_gfp & __GFP_DIRECT_RECLAIM) && oo_order(oo) > oo_order(s->min))
> 		alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~(__GFP_RECLAIM|__GFP_NOFAIL);
> 
>-	slab = alloc_slab_page(s, alloc_gfp, node, oo);
>+	slab = alloc_slab_page(alloc_gfp, node, oo);
> 	if (unlikely(!slab)) {
> 		oo = s->min;
> 		alloc_gfp = flags;
>@@ -1949,7 +1949,7 @@ static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> 		 * Allocation may have failed due to fragmentation.
> 		 * Try a lower order alloc if possible
> 		 */
>-		slab = alloc_slab_page(s, alloc_gfp, node, oo);
>+		slab = alloc_slab_page(alloc_gfp, node, oo);
> 		if (unlikely(!slab))
> 			goto out;
> 		stat(s, ORDER_FALLBACK);

Looks good, nice changelog!

Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] Cleanups for slab
  2022-03-10 14:06 [PATCH v2 0/2] Cleanups for slab sxwjean
                   ` (2 preceding siblings ...)
  2022-03-10 14:45 ` Hyeonggon Yoo
@ 2022-03-10 17:20 ` Vlastimil Babka
  3 siblings, 0 replies; 6+ messages in thread
From: Vlastimil Babka @ 2022-03-10 17:20 UTC (permalink / raw)
  To: sxwjean, cl, penberg, rientjes, iamjoonsoo.kim, akpm, longman,
	guro, willy, roman.gushchin
  Cc: linux-mm, linux-kernel, Xiongwei Song

On 3/10/22 15:06, sxwjean@me.com wrote:
> From: Xiongwei Song <sxwjean@gmail.com>
> 
> 2 cleanups, no functionality changed.

Thanks, added to slab for-next

> ---
> Since v2:
>  - Add the detailed history of parameter @s of alloc_slab_page(),
>    message from Matthew Wilcox.
>  - Collect Reviewed-by and Acked-by. Thanks Matthew Wilcox, David Rientjes
>    and Roman Gushchin.
> 
> Since v1:
>  - https://lore.kernel.org/all/20220309145052.219138-1-sxwjean@me.com/
> ---
> 
> Xiongwei Song (2):
>   mm: slab: Delete unused SLAB_DEACTIVATED flag
>   mm: slub: Delete useless parameter of alloc_slab_page()
> 
>  include/linux/slab.h | 3 ---
>  mm/slub.c            | 8 ++++----
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-10 17:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 14:06 [PATCH v2 0/2] Cleanups for slab sxwjean
2022-03-10 14:07 ` [PATCH v2 1/2] mm: slab: Delete unused SLAB_DEACTIVATED flag sxwjean
2022-03-10 14:27   ` Hyeonggon Yoo
2022-03-10 14:07 ` [PATCH v2 2/2] mm: slub: Delete useless parameter of alloc_slab_page() sxwjean
2022-03-10 14:45 ` Hyeonggon Yoo
2022-03-10 17:20 ` [PATCH v2 0/2] Cleanups for slab Vlastimil Babka

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).