linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] cleanup of SLAB_ flags
@ 2024-02-20 16:58 Vlastimil Babka
  2024-02-20 16:58 ` [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag Vlastimil Babka
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-20 16:58 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino
  Cc: Zheng Yejian, Xiongwei Song, Chengming Zhou, linux-mm,
	linux-kernel, kasan-dev, Vlastimil Babka, Steven Rostedt

This started by the report that SLAB_MEM_SPREAD flag is dead (Patch 1).
Then in the alloc profiling series we realized it's too easy to reuse an
existing SLAB_ flag's value when defining a new one, by mistake.
Thus let the compiler do that for us via a new helper enum (Patch 2).
When checking if more flags are dead or could be removed, didn't spot
any, but found out the SLAB_KASAN handling of preventing cache merging
can be simplified since we now have an explicit SLAB_NO_MERGE (Patch 3).

The SLAB_MEM_SPREAD flag is now marked as unused and for removal, and
has a value of 0 so it's a no-op. Patches to remove its usage can/will
be submitted to respective subsystems independently of this series - the
flag is already dead as of v6.8-rc1 with SLAB removed. The removal of
dead cpuset_do_slab_mem_spread() code can also be submitted
independently.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
Vlastimil Babka (3):
      mm, slab: deprecate SLAB_MEM_SPREAD flag
      mm, slab: use an enum to define SLAB_ cache creation flags
      mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE

 include/linux/kasan.h |  6 ----
 include/linux/slab.h  | 86 +++++++++++++++++++++++++++++++++++++--------------
 mm/kasan/generic.c    | 16 +++-------
 mm/slab.h             |  1 -
 mm/slab_common.c      |  2 +-
 mm/slub.c             |  6 ++--
 6 files changed, 71 insertions(+), 46 deletions(-)
---
base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
change-id: 20240219-slab-cleanup-flags-c864415ecc8e

Best regards,
-- 
Vlastimil Babka <vbabka@suse.cz>



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

* [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-20 16:58 [PATCH 0/3] cleanup of SLAB_ flags Vlastimil Babka
@ 2024-02-20 16:58 ` Vlastimil Babka
  2024-02-21  2:17   ` Song, Xiongwei
                     ` (2 more replies)
  2024-02-20 16:58 ` [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags Vlastimil Babka
  2024-02-20 16:58 ` [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE Vlastimil Babka
  2 siblings, 3 replies; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-20 16:58 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino
  Cc: Zheng Yejian, Xiongwei Song, Chengming Zhou, linux-mm,
	linux-kernel, kasan-dev, Vlastimil Babka, Steven Rostedt

The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
removed.  SLUB instead relies on the page allocator's NUMA policies.
Change the flag's value to 0 to free up the value it had, and mark it
for full removal once all users are gone.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 include/linux/slab.h | 5 +++--
 mm/slab.h            | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index b5f5ee8308d0..6252f44115c2 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -96,8 +96,6 @@
  */
 /* Defer freeing slabs to RCU */
 #define SLAB_TYPESAFE_BY_RCU	((slab_flags_t __force)0x00080000U)
-/* Spread some memory over cpuset */
-#define SLAB_MEM_SPREAD		((slab_flags_t __force)0x00100000U)
 /* Trace allocations and frees */
 #define SLAB_TRACE		((slab_flags_t __force)0x00200000U)
 
@@ -164,6 +162,9 @@
 #endif
 #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */
 
+/* Obsolete unused flag, to be removed */
+#define SLAB_MEM_SPREAD		0
+
 /*
  * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
  *
diff --git a/mm/slab.h b/mm/slab.h
index 54deeb0428c6..f4534eefb35d 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -469,7 +469,6 @@ static inline bool is_kmalloc_cache(struct kmem_cache *s)
 			      SLAB_STORE_USER | \
 			      SLAB_TRACE | \
 			      SLAB_CONSISTENCY_CHECKS | \
-			      SLAB_MEM_SPREAD | \
 			      SLAB_NOLEAKTRACE | \
 			      SLAB_RECLAIM_ACCOUNT | \
 			      SLAB_TEMPORARY | \

-- 
2.43.1



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

* [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-20 16:58 [PATCH 0/3] cleanup of SLAB_ flags Vlastimil Babka
  2024-02-20 16:58 ` [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag Vlastimil Babka
@ 2024-02-20 16:58 ` Vlastimil Babka
  2024-02-21  2:23   ` Song, Xiongwei
                     ` (4 more replies)
  2024-02-20 16:58 ` [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE Vlastimil Babka
  2 siblings, 5 replies; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-20 16:58 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino
  Cc: Zheng Yejian, Xiongwei Song, Chengming Zhou, linux-mm,
	linux-kernel, kasan-dev, Vlastimil Babka

The values of SLAB_ cache creation flagsare defined by hand, which is
tedious and error-prone. Use an enum to assign the bit number and a
__SF_BIT() macro to #define the final flags.

This renumbers the flag values, which is OK as they are only used
internally.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 include/linux/slab.h | 81 ++++++++++++++++++++++++++++++++++++++--------------
 mm/slub.c            |  6 ++--
 2 files changed, 63 insertions(+), 24 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 6252f44115c2..f893a132dd5a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -21,29 +21,68 @@
 #include <linux/cleanup.h>
 #include <linux/hash.h>
 
+enum _slab_flag_bits {
+	_SLAB_CONSISTENCY_CHECKS,
+	_SLAB_RED_ZONE,
+	_SLAB_POISON,
+	_SLAB_KMALLOC,
+	_SLAB_HWCACHE_ALIGN,
+	_SLAB_CACHE_DMA,
+	_SLAB_CACHE_DMA32,
+	_SLAB_STORE_USER,
+	_SLAB_PANIC,
+	_SLAB_TYPESAFE_BY_RCU,
+	_SLAB_TRACE,
+#ifdef CONFIG_DEBUG_OBJECTS
+	_SLAB_DEBUG_OBJECTS,
+#endif
+	_SLAB_NOLEAKTRACE,
+	_SLAB_NO_MERGE,
+#ifdef CONFIG_FAILSLAB
+	_SLAB_FAILSLAB,
+#endif
+#ifdef CONFIG_MEMCG_KMEM
+	_SLAB_ACCOUNT,
+#endif
+#ifdef CONFIG_KASAN_GENERIC
+	_SLAB_KASAN,
+#endif
+	_SLAB_NO_USER_FLAGS,
+#ifdef CONFIG_KFENCE
+	_SLAB_SKIP_KFENCE,
+#endif
+#ifndef CONFIG_SLUB_TINY
+	_SLAB_RECLAIM_ACCOUNT,
+#endif
+	_SLAB_OBJECT_POISON,
+	_SLAB_CMPXCHG_DOUBLE,
+	_SLAB_FLAGS_LAST_BIT
+};
+
+#define __SF_BIT(nr)	((slab_flags_t __force)(1U << (nr)))
 
 /*
  * Flags to pass to kmem_cache_create().
  * The ones marked DEBUG need CONFIG_SLUB_DEBUG enabled, otherwise are no-op
  */
 /* DEBUG: Perform (expensive) checks on alloc/free */
-#define SLAB_CONSISTENCY_CHECKS	((slab_flags_t __force)0x00000100U)
+#define SLAB_CONSISTENCY_CHECKS	__SF_BIT(_SLAB_CONSISTENCY_CHECKS)
 /* DEBUG: Red zone objs in a cache */
-#define SLAB_RED_ZONE		((slab_flags_t __force)0x00000400U)
+#define SLAB_RED_ZONE		__SF_BIT(_SLAB_RED_ZONE)
 /* DEBUG: Poison objects */
-#define SLAB_POISON		((slab_flags_t __force)0x00000800U)
+#define SLAB_POISON		__SF_BIT(_SLAB_POISON)
 /* Indicate a kmalloc slab */
-#define SLAB_KMALLOC		((slab_flags_t __force)0x00001000U)
+#define SLAB_KMALLOC		__SF_BIT(_SLAB_KMALLOC)
 /* Align objs on cache lines */
-#define SLAB_HWCACHE_ALIGN	((slab_flags_t __force)0x00002000U)
+#define SLAB_HWCACHE_ALIGN	__SF_BIT(_SLAB_HWCACHE_ALIGN)
 /* Use GFP_DMA memory */
-#define SLAB_CACHE_DMA		((slab_flags_t __force)0x00004000U)
+#define SLAB_CACHE_DMA		__SF_BIT(_SLAB_CACHE_DMA)
 /* Use GFP_DMA32 memory */
-#define SLAB_CACHE_DMA32	((slab_flags_t __force)0x00008000U)
+#define SLAB_CACHE_DMA32	__SF_BIT(_SLAB_CACHE_DMA32)
 /* DEBUG: Store the last owner for bug hunting */
-#define SLAB_STORE_USER		((slab_flags_t __force)0x00010000U)
+#define SLAB_STORE_USER		__SF_BIT(_SLAB_STORE_USER)
 /* Panic if kmem_cache_create() fails */
-#define SLAB_PANIC		((slab_flags_t __force)0x00040000U)
+#define SLAB_PANIC		__SF_BIT(_SLAB_PANIC)
 /*
  * SLAB_TYPESAFE_BY_RCU - **WARNING** READ THIS!
  *
@@ -95,19 +134,19 @@
  * Note that SLAB_TYPESAFE_BY_RCU was originally named SLAB_DESTROY_BY_RCU.
  */
 /* Defer freeing slabs to RCU */
-#define SLAB_TYPESAFE_BY_RCU	((slab_flags_t __force)0x00080000U)
+#define SLAB_TYPESAFE_BY_RCU	__SF_BIT(_SLAB_TYPESAFE_BY_RCU)
 /* Trace allocations and frees */
-#define SLAB_TRACE		((slab_flags_t __force)0x00200000U)
+#define SLAB_TRACE		__SF_BIT(_SLAB_TRACE)
 
 /* Flag to prevent checks on free */
 #ifdef CONFIG_DEBUG_OBJECTS
-# define SLAB_DEBUG_OBJECTS	((slab_flags_t __force)0x00400000U)
+# define SLAB_DEBUG_OBJECTS	__SF_BIT(_SLAB_DEBUG_OBJECTS)
 #else
 # define SLAB_DEBUG_OBJECTS	0
 #endif
 
 /* Avoid kmemleak tracing */
-#define SLAB_NOLEAKTRACE	((slab_flags_t __force)0x00800000U)
+#define SLAB_NOLEAKTRACE	__SF_BIT(_SLAB_NOLEAKTRACE)
 
 /*
  * Prevent merging with compatible kmem caches. This flag should be used
@@ -119,23 +158,23 @@
  * - performance critical caches, should be very rare and consulted with slab
  *   maintainers, and not used together with CONFIG_SLUB_TINY
  */
-#define SLAB_NO_MERGE		((slab_flags_t __force)0x01000000U)
+#define SLAB_NO_MERGE		__SF_BIT(_SLAB_NO_MERGE)
 
 /* Fault injection mark */
 #ifdef CONFIG_FAILSLAB
-# define SLAB_FAILSLAB		((slab_flags_t __force)0x02000000U)
+# define SLAB_FAILSLAB		__SF_BIT(_SLAB_FAILSLAB)
 #else
 # define SLAB_FAILSLAB		0
 #endif
 /* Account to memcg */
 #ifdef CONFIG_MEMCG_KMEM
-# define SLAB_ACCOUNT		((slab_flags_t __force)0x04000000U)
+# define SLAB_ACCOUNT		__SF_BIT(_SLAB_ACCOUNT)
 #else
 # define SLAB_ACCOUNT		0
 #endif
 
 #ifdef CONFIG_KASAN_GENERIC
-#define SLAB_KASAN		((slab_flags_t __force)0x08000000U)
+#define SLAB_KASAN		__SF_BIT(_SLAB_KASAN)
 #else
 #define SLAB_KASAN		0
 #endif
@@ -145,10 +184,10 @@
  * Intended for caches created for self-tests so they have only flags
  * specified in the code and other flags are ignored.
  */
-#define SLAB_NO_USER_FLAGS	((slab_flags_t __force)0x10000000U)
+#define SLAB_NO_USER_FLAGS	__SF_BIT(_SLAB_NO_USER_FLAGS)
 
 #ifdef CONFIG_KFENCE
-#define SLAB_SKIP_KFENCE	((slab_flags_t __force)0x20000000U)
+#define SLAB_SKIP_KFENCE	__SF_BIT(_SLAB_SKIP_KFENCE)
 #else
 #define SLAB_SKIP_KFENCE	0
 #endif
@@ -156,9 +195,9 @@
 /* The following flags affect the page allocator grouping pages by mobility */
 /* Objects are reclaimable */
 #ifndef CONFIG_SLUB_TINY
-#define SLAB_RECLAIM_ACCOUNT	((slab_flags_t __force)0x00020000U)
+#define SLAB_RECLAIM_ACCOUNT	__SF_BIT(_SLAB_RECLAIM_ACCOUNT)
 #else
-#define SLAB_RECLAIM_ACCOUNT	((slab_flags_t __force)0)
+#define SLAB_RECLAIM_ACCOUNT	0
 #endif
 #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */
 
diff --git a/mm/slub.c b/mm/slub.c
index 2ef88bbf56a3..a93c5a17cbbb 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -306,13 +306,13 @@ static inline bool kmem_cache_has_cpu_partial(struct kmem_cache *s)
 
 /* Internal SLUB flags */
 /* Poison object */
-#define __OBJECT_POISON		((slab_flags_t __force)0x80000000U)
+#define __OBJECT_POISON		__SF_BIT(_SLAB_OBJECT_POISON)
 /* Use cmpxchg_double */
 
 #ifdef system_has_freelist_aba
-#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0x40000000U)
+#define __CMPXCHG_DOUBLE	__SF_BIT(_SLAB_CMPXCHG_DOUBLE)
 #else
-#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0U)
+#define __CMPXCHG_DOUBLE	0
 #endif
 
 /*

-- 
2.43.1



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

* [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE
  2024-02-20 16:58 [PATCH 0/3] cleanup of SLAB_ flags Vlastimil Babka
  2024-02-20 16:58 ` [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag Vlastimil Babka
  2024-02-20 16:58 ` [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags Vlastimil Babka
@ 2024-02-20 16:58 ` Vlastimil Babka
  2024-02-21  2:25   ` Song, Xiongwei
                     ` (2 more replies)
  2 siblings, 3 replies; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-20 16:58 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino
  Cc: Zheng Yejian, Xiongwei Song, Chengming Zhou, linux-mm,
	linux-kernel, kasan-dev, Vlastimil Babka

The SLAB_KASAN flag prevents merging of caches in some configurations,
which is handled in a rather complicated way via kasan_never_merge().
Since we now have a generic SLAB_NO_MERGE flag, we can instead use it
for KASAN caches in addition to SLAB_KASAN in those configurations,
and simplify the SLAB_NEVER_MERGE handling.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 include/linux/kasan.h |  6 ------
 mm/kasan/generic.c    | 16 ++++------------
 mm/slab_common.c      |  2 +-
 3 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index dbb06d789e74..70d6a8f6e25d 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -429,7 +429,6 @@ struct kasan_cache {
 };
 
 size_t kasan_metadata_size(struct kmem_cache *cache, bool in_object);
-slab_flags_t kasan_never_merge(void);
 void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
 			slab_flags_t *flags);
 
@@ -446,11 +445,6 @@ static inline size_t kasan_metadata_size(struct kmem_cache *cache,
 {
 	return 0;
 }
-/* And thus nothing prevents cache merging. */
-static inline slab_flags_t kasan_never_merge(void)
-{
-	return 0;
-}
 /* And no cache-related metadata initialization is required. */
 static inline void kasan_cache_create(struct kmem_cache *cache,
 				      unsigned int *size,
diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
index df6627f62402..d8b78d273b9f 100644
--- a/mm/kasan/generic.c
+++ b/mm/kasan/generic.c
@@ -334,14 +334,6 @@ DEFINE_ASAN_SET_SHADOW(f3);
 DEFINE_ASAN_SET_SHADOW(f5);
 DEFINE_ASAN_SET_SHADOW(f8);
 
-/* Only allow cache merging when no per-object metadata is present. */
-slab_flags_t kasan_never_merge(void)
-{
-	if (!kasan_requires_meta())
-		return 0;
-	return SLAB_KASAN;
-}
-
 /*
  * Adaptive redzone policy taken from the userspace AddressSanitizer runtime.
  * For larger allocations larger redzones are used.
@@ -372,13 +364,13 @@ void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
 	/*
 	 * SLAB_KASAN is used to mark caches that are sanitized by KASAN
 	 * and that thus have per-object metadata.
-	 * Currently this flag is used in two places:
+	 * Currently this flag is used in one place:
 	 * 1. In slab_ksize() to account for per-object metadata when
 	 *    calculating the size of the accessible memory within the object.
-	 * 2. In slab_common.c via kasan_never_merge() to prevent merging of
-	 *    caches with per-object metadata.
+	 * Additionally, we use SLAB_NO_MERGE to prevent merging of caches
+	 * with per-object metadata.
 	 */
-	*flags |= SLAB_KASAN;
+	*flags |= SLAB_KASAN | SLAB_NO_MERGE;
 
 	ok_size = *size;
 
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 238293b1dbe1..7cfa2f1ce655 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -50,7 +50,7 @@ static DECLARE_WORK(slab_caches_to_rcu_destroy_work,
  */
 #define SLAB_NEVER_MERGE (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
 		SLAB_TRACE | SLAB_TYPESAFE_BY_RCU | SLAB_NOLEAKTRACE | \
-		SLAB_FAILSLAB | SLAB_NO_MERGE | kasan_never_merge())
+		SLAB_FAILSLAB | SLAB_NO_MERGE)
 
 #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | \
 			 SLAB_CACHE_DMA32 | SLAB_ACCOUNT)

-- 
2.43.1



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

* RE: [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-20 16:58 ` [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag Vlastimil Babka
@ 2024-02-21  2:17   ` Song, Xiongwei
  2024-02-21  7:11   ` Chengming Zhou
  2024-02-21 18:30   ` Roman Gushchin
  2 siblings, 0 replies; 23+ messages in thread
From: Song, Xiongwei @ 2024-02-21  2:17 UTC (permalink / raw)
  To: Vlastimil Babka, Christoph Lameter, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Andrew Morton, Roman Gushchin, Hyeonggon Yoo,
	Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Vincenzo Frascino
  Cc: Zheng Yejian, Chengming Zhou, linux-mm, linux-kernel, kasan-dev,
	Steven Rostedt

> The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
> removed.  SLUB instead relies on the page allocator's NUMA policies.
> Change the flag's value to 0 to free up the value it had, and mark it
> for full removal once all users are gone.
> 
> Reported-by: Steven Rostedt <rostedt@goodmis.org>
> Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Ran a rough test with build and bootup, feel free to add

Tested-by: Xiongwei Song <xiongwei.song@windriver.com>
Reviewed-by: Xiongwei Song <xiongwei.song@windriver.com>

> ---
>  include/linux/slab.h | 5 +++--
>  mm/slab.h            | 1 -
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index b5f5ee8308d0..6252f44115c2 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -96,8 +96,6 @@
>   */
>  /* Defer freeing slabs to RCU */
>  #define SLAB_TYPESAFE_BY_RCU   ((slab_flags_t __force)0x00080000U)
> -/* Spread some memory over cpuset */
> -#define SLAB_MEM_SPREAD                ((slab_flags_t __force)0x00100000U)
>  /* Trace allocations and frees */
>  #define SLAB_TRACE             ((slab_flags_t __force)0x00200000U)
> 
> @@ -164,6 +162,9 @@
>  #endif
>  #define SLAB_TEMPORARY         SLAB_RECLAIM_ACCOUNT    /* Objects are short-lived */
> 
> +/* Obsolete unused flag, to be removed */
> +#define SLAB_MEM_SPREAD                0
> +
>  /*
>   * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
>   *
> diff --git a/mm/slab.h b/mm/slab.h
> index 54deeb0428c6..f4534eefb35d 100644
> --- a/mm/slab.h
> +++ b/mm/slab.h
> @@ -469,7 +469,6 @@ static inline bool is_kmalloc_cache(struct kmem_cache *s)
>                               SLAB_STORE_USER | \
>                               SLAB_TRACE | \
>                               SLAB_CONSISTENCY_CHECKS | \
> -                             SLAB_MEM_SPREAD | \
>                               SLAB_NOLEAKTRACE | \
>                               SLAB_RECLAIM_ACCOUNT | \
>                               SLAB_TEMPORARY | \
> 
> --
> 2.43.1


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

* RE: [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-20 16:58 ` [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags Vlastimil Babka
@ 2024-02-21  2:23   ` Song, Xiongwei
  2024-02-21  7:13   ` Chengming Zhou
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: Song, Xiongwei @ 2024-02-21  2:23 UTC (permalink / raw)
  To: Vlastimil Babka, Christoph Lameter, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Andrew Morton, Roman Gushchin, Hyeonggon Yoo,
	Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Vincenzo Frascino
  Cc: Zheng Yejian, Chengming Zhou, linux-mm, linux-kernel, kasan-dev


> The values of SLAB_ cache creation flagsare defined by hand, which is

A blank space missed between flags and are.

> tedious and error-prone. Use an enum to assign the bit number and a
> __SF_BIT() macro to #define the final flags.
> 
> This renumbers the flag values, which is OK as they are only used
> internally.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Ran a rough test with build and bootup with the related debug configs enabled,
feel free to add

Tested-by: Xiongwei Song <xiongwei.song@windriver.com>
Reviewed-by: Xiongwei Song <xiongwei.song@windriver.com>

Thanks,
Xiognwei
> ---
>  include/linux/slab.h | 81 ++++++++++++++++++++++++++++++++++++++--------------
>  mm/slub.c            |  6 ++--
>  2 files changed, 63 insertions(+), 24 deletions(-)
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 6252f44115c2..f893a132dd5a 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -21,29 +21,68 @@
>  #include <linux/cleanup.h>
>  #include <linux/hash.h>
> 
> +enum _slab_flag_bits {
> +       _SLAB_CONSISTENCY_CHECKS,
> +       _SLAB_RED_ZONE,
> +       _SLAB_POISON,
> +       _SLAB_KMALLOC,
> +       _SLAB_HWCACHE_ALIGN,
> +       _SLAB_CACHE_DMA,
> +       _SLAB_CACHE_DMA32,
> +       _SLAB_STORE_USER,
> +       _SLAB_PANIC,
> +       _SLAB_TYPESAFE_BY_RCU,
> +       _SLAB_TRACE,
> +#ifdef CONFIG_DEBUG_OBJECTS
> +       _SLAB_DEBUG_OBJECTS,
> +#endif
> +       _SLAB_NOLEAKTRACE,
> +       _SLAB_NO_MERGE,
> +#ifdef CONFIG_FAILSLAB
> +       _SLAB_FAILSLAB,
> +#endif
> +#ifdef CONFIG_MEMCG_KMEM
> +       _SLAB_ACCOUNT,
> +#endif
> +#ifdef CONFIG_KASAN_GENERIC
> +       _SLAB_KASAN,
> +#endif
> +       _SLAB_NO_USER_FLAGS,
> +#ifdef CONFIG_KFENCE
> +       _SLAB_SKIP_KFENCE,
> +#endif
> +#ifndef CONFIG_SLUB_TINY
> +       _SLAB_RECLAIM_ACCOUNT,
> +#endif
> +       _SLAB_OBJECT_POISON,
> +       _SLAB_CMPXCHG_DOUBLE,
> +       _SLAB_FLAGS_LAST_BIT
> +};
> +
> +#define __SF_BIT(nr)   ((slab_flags_t __force)(1U << (nr)))
> 
>  /*
>   * Flags to pass to kmem_cache_create().
>   * The ones marked DEBUG need CONFIG_SLUB_DEBUG enabled, otherwise are no-op
>   */
>  /* DEBUG: Perform (expensive) checks on alloc/free */
> -#define SLAB_CONSISTENCY_CHECKS        ((slab_flags_t __force)0x00000100U)
> +#define SLAB_CONSISTENCY_CHECKS        __SF_BIT(_SLAB_CONSISTENCY_CHECKS)
>  /* DEBUG: Red zone objs in a cache */
> -#define SLAB_RED_ZONE          ((slab_flags_t __force)0x00000400U)
> +#define SLAB_RED_ZONE          __SF_BIT(_SLAB_RED_ZONE)
>  /* DEBUG: Poison objects */
> -#define SLAB_POISON            ((slab_flags_t __force)0x00000800U)
> +#define SLAB_POISON            __SF_BIT(_SLAB_POISON)
>  /* Indicate a kmalloc slab */
> -#define SLAB_KMALLOC           ((slab_flags_t __force)0x00001000U)
> +#define SLAB_KMALLOC           __SF_BIT(_SLAB_KMALLOC)
>  /* Align objs on cache lines */
> -#define SLAB_HWCACHE_ALIGN     ((slab_flags_t __force)0x00002000U)
> +#define SLAB_HWCACHE_ALIGN     __SF_BIT(_SLAB_HWCACHE_ALIGN)
>  /* Use GFP_DMA memory */
> -#define SLAB_CACHE_DMA         ((slab_flags_t __force)0x00004000U)
> +#define SLAB_CACHE_DMA         __SF_BIT(_SLAB_CACHE_DMA)
>  /* Use GFP_DMA32 memory */
> -#define SLAB_CACHE_DMA32       ((slab_flags_t __force)0x00008000U)
> +#define SLAB_CACHE_DMA32       __SF_BIT(_SLAB_CACHE_DMA32)
>  /* DEBUG: Store the last owner for bug hunting */
> -#define SLAB_STORE_USER                ((slab_flags_t __force)0x00010000U)
> +#define SLAB_STORE_USER                __SF_BIT(_SLAB_STORE_USER)
>  /* Panic if kmem_cache_create() fails */
> -#define SLAB_PANIC             ((slab_flags_t __force)0x00040000U)
> +#define SLAB_PANIC             __SF_BIT(_SLAB_PANIC)
>  /*
>   * SLAB_TYPESAFE_BY_RCU - **WARNING** READ THIS!
>   *
> @@ -95,19 +134,19 @@
>   * Note that SLAB_TYPESAFE_BY_RCU was originally named SLAB_DESTROY_BY_RCU.
>   */
>  /* Defer freeing slabs to RCU */
> -#define SLAB_TYPESAFE_BY_RCU   ((slab_flags_t __force)0x00080000U)
> +#define SLAB_TYPESAFE_BY_RCU   __SF_BIT(_SLAB_TYPESAFE_BY_RCU)
>  /* Trace allocations and frees */
> -#define SLAB_TRACE             ((slab_flags_t __force)0x00200000U)
> +#define SLAB_TRACE             __SF_BIT(_SLAB_TRACE)
> 
>  /* Flag to prevent checks on free */
>  #ifdef CONFIG_DEBUG_OBJECTS
> -# define SLAB_DEBUG_OBJECTS    ((slab_flags_t __force)0x00400000U)
> +# define SLAB_DEBUG_OBJECTS    __SF_BIT(_SLAB_DEBUG_OBJECTS)
>  #else
>  # define SLAB_DEBUG_OBJECTS    0
>  #endif
> 
>  /* Avoid kmemleak tracing */
> -#define SLAB_NOLEAKTRACE       ((slab_flags_t __force)0x00800000U)
> +#define SLAB_NOLEAKTRACE       __SF_BIT(_SLAB_NOLEAKTRACE)
> 
>  /*
>   * Prevent merging with compatible kmem caches. This flag should be used
> @@ -119,23 +158,23 @@
>   * - performance critical caches, should be very rare and consulted with slab
>   *   maintainers, and not used together with CONFIG_SLUB_TINY
>   */
> -#define SLAB_NO_MERGE          ((slab_flags_t __force)0x01000000U)
> +#define SLAB_NO_MERGE          __SF_BIT(_SLAB_NO_MERGE)
> 
>  /* Fault injection mark */
>  #ifdef CONFIG_FAILSLAB
> -# define SLAB_FAILSLAB         ((slab_flags_t __force)0x02000000U)
> +# define SLAB_FAILSLAB         __SF_BIT(_SLAB_FAILSLAB)
>  #else
>  # define SLAB_FAILSLAB         0
>  #endif
>  /* Account to memcg */
>  #ifdef CONFIG_MEMCG_KMEM
> -# define SLAB_ACCOUNT          ((slab_flags_t __force)0x04000000U)
> +# define SLAB_ACCOUNT          __SF_BIT(_SLAB_ACCOUNT)
>  #else
>  # define SLAB_ACCOUNT          0
>  #endif
> 
>  #ifdef CONFIG_KASAN_GENERIC
> -#define SLAB_KASAN             ((slab_flags_t __force)0x08000000U)
> +#define SLAB_KASAN             __SF_BIT(_SLAB_KASAN)
>  #else
>  #define SLAB_KASAN             0
>  #endif
> @@ -145,10 +184,10 @@
>   * Intended for caches created for self-tests so they have only flags
>   * specified in the code and other flags are ignored.
>   */
> -#define SLAB_NO_USER_FLAGS     ((slab_flags_t __force)0x10000000U)
> +#define SLAB_NO_USER_FLAGS     __SF_BIT(_SLAB_NO_USER_FLAGS)
> 
>  #ifdef CONFIG_KFENCE
> -#define SLAB_SKIP_KFENCE       ((slab_flags_t __force)0x20000000U)
> +#define SLAB_SKIP_KFENCE       __SF_BIT(_SLAB_SKIP_KFENCE)
>  #else
>  #define SLAB_SKIP_KFENCE       0
>  #endif
> @@ -156,9 +195,9 @@
>  /* The following flags affect the page allocator grouping pages by mobility */
>  /* Objects are reclaimable */
>  #ifndef CONFIG_SLUB_TINY
> -#define SLAB_RECLAIM_ACCOUNT   ((slab_flags_t __force)0x00020000U)
> +#define SLAB_RECLAIM_ACCOUNT   __SF_BIT(_SLAB_RECLAIM_ACCOUNT)
>  #else
> -#define SLAB_RECLAIM_ACCOUNT   ((slab_flags_t __force)0)
> +#define SLAB_RECLAIM_ACCOUNT   0
>  #endif
>  #define SLAB_TEMPORARY         SLAB_RECLAIM_ACCOUNT    /* Objects are short-lived */
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 2ef88bbf56a3..a93c5a17cbbb 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -306,13 +306,13 @@ static inline bool kmem_cache_has_cpu_partial(struct
> kmem_cache *s)
> 
>  /* Internal SLUB flags */
>  /* Poison object */
> -#define __OBJECT_POISON                ((slab_flags_t __force)0x80000000U)
> +#define __OBJECT_POISON                __SF_BIT(_SLAB_OBJECT_POISON)
>  /* Use cmpxchg_double */
> 
>  #ifdef system_has_freelist_aba
> -#define __CMPXCHG_DOUBLE       ((slab_flags_t __force)0x40000000U)
> +#define __CMPXCHG_DOUBLE       __SF_BIT(_SLAB_CMPXCHG_DOUBLE)
>  #else
> -#define __CMPXCHG_DOUBLE       ((slab_flags_t __force)0U)
> +#define __CMPXCHG_DOUBLE       0
>  #endif
> 
>  /*
> 
> --
> 2.43.1


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

* RE: [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE
  2024-02-20 16:58 ` [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE Vlastimil Babka
@ 2024-02-21  2:25   ` Song, Xiongwei
  2024-02-21  7:14   ` Chengming Zhou
  2024-02-21 20:48   ` Andrey Konovalov
  2 siblings, 0 replies; 23+ messages in thread
From: Song, Xiongwei @ 2024-02-21  2:25 UTC (permalink / raw)
  To: Vlastimil Babka, Christoph Lameter, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Andrew Morton, Roman Gushchin, Hyeonggon Yoo,
	Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Vincenzo Frascino
  Cc: Zheng Yejian, Chengming Zhou, linux-mm, linux-kernel, kasan-dev


> The SLAB_KASAN flag prevents merging of caches in some configurations,
> which is handled in a rather complicated way via kasan_never_merge().
> Since we now have a generic SLAB_NO_MERGE flag, we can instead use it
> for KASAN caches in addition to SLAB_KASAN in those configurations,
> and simplify the SLAB_NEVER_MERGE handling.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Ran a rough test with build and bootup with CONFIG_KASAN_GENERIC enabled,
feel free to add

Tested-by: Xiongwei Song <xiongwei.song@windriver.com>

Thanks,
Xiongwei

> ---
>  include/linux/kasan.h |  6 ------
>  mm/kasan/generic.c    | 16 ++++------------
>  mm/slab_common.c      |  2 +-
>  3 files changed, 5 insertions(+), 19 deletions(-)
> 
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index dbb06d789e74..70d6a8f6e25d 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -429,7 +429,6 @@ struct kasan_cache {
>  };
> 
>  size_t kasan_metadata_size(struct kmem_cache *cache, bool in_object);
> -slab_flags_t kasan_never_merge(void);
>  void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
>                         slab_flags_t *flags);
> 
> @@ -446,11 +445,6 @@ static inline size_t kasan_metadata_size(struct kmem_cache
> *cache,
>  {
>         return 0;
>  }
> -/* And thus nothing prevents cache merging. */
> -static inline slab_flags_t kasan_never_merge(void)
> -{
> -       return 0;
> -}
>  /* And no cache-related metadata initialization is required. */
>  static inline void kasan_cache_create(struct kmem_cache *cache,
>                                       unsigned int *size,
> diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> index df6627f62402..d8b78d273b9f 100644
> --- a/mm/kasan/generic.c
> +++ b/mm/kasan/generic.c
> @@ -334,14 +334,6 @@ DEFINE_ASAN_SET_SHADOW(f3);
>  DEFINE_ASAN_SET_SHADOW(f5);
>  DEFINE_ASAN_SET_SHADOW(f8);
> 
> -/* Only allow cache merging when no per-object metadata is present. */
> -slab_flags_t kasan_never_merge(void)
> -{
> -       if (!kasan_requires_meta())
> -               return 0;
> -       return SLAB_KASAN;
> -}
> -
>  /*
>   * Adaptive redzone policy taken from the userspace AddressSanitizer runtime.
>   * For larger allocations larger redzones are used.
> @@ -372,13 +364,13 @@ void kasan_cache_create(struct kmem_cache *cache, unsigned
> int *size,
>         /*
>          * SLAB_KASAN is used to mark caches that are sanitized by KASAN
>          * and that thus have per-object metadata.
> -        * Currently this flag is used in two places:
> +        * Currently this flag is used in one place:
>          * 1. In slab_ksize() to account for per-object metadata when
>          *    calculating the size of the accessible memory within the object.
> -        * 2. In slab_common.c via kasan_never_merge() to prevent merging of
> -        *    caches with per-object metadata.
> +        * Additionally, we use SLAB_NO_MERGE to prevent merging of caches
> +        * with per-object metadata.
>          */
> -       *flags |= SLAB_KASAN;
> +       *flags |= SLAB_KASAN | SLAB_NO_MERGE;
> 
>         ok_size = *size;
> 
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 238293b1dbe1..7cfa2f1ce655 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -50,7 +50,7 @@ static DECLARE_WORK(slab_caches_to_rcu_destroy_work,
>   */
>  #define SLAB_NEVER_MERGE (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
>                 SLAB_TRACE | SLAB_TYPESAFE_BY_RCU | SLAB_NOLEAKTRACE | \
> -               SLAB_FAILSLAB | SLAB_NO_MERGE | kasan_never_merge())
> +               SLAB_FAILSLAB | SLAB_NO_MERGE)
> 
>  #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | \
>                          SLAB_CACHE_DMA32 | SLAB_ACCOUNT)
> 
> --
> 2.43.1


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

* Re: [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-20 16:58 ` [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag Vlastimil Babka
  2024-02-21  2:17   ` Song, Xiongwei
@ 2024-02-21  7:11   ` Chengming Zhou
  2024-02-21 18:30   ` Roman Gushchin
  2 siblings, 0 replies; 23+ messages in thread
From: Chengming Zhou @ 2024-02-21  7:11 UTC (permalink / raw)
  To: Vlastimil Babka, Christoph Lameter, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Andrew Morton, Roman Gushchin, Hyeonggon Yoo,
	Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Vincenzo Frascino
  Cc: Zheng Yejian, Xiongwei Song, linux-mm, linux-kernel, kasan-dev,
	Steven Rostedt

On 2024/2/21 00:58, Vlastimil Babka wrote:
> The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
> removed.  SLUB instead relies on the page allocator's NUMA policies.
> Change the flag's value to 0 to free up the value it had, and mark it
> for full removal once all users are gone.
> 
> Reported-by: Steven Rostedt <rostedt@goodmis.org>
> Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>

Thanks!

> ---
>  include/linux/slab.h | 5 +++--
>  mm/slab.h            | 1 -
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index b5f5ee8308d0..6252f44115c2 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -96,8 +96,6 @@
>   */
>  /* Defer freeing slabs to RCU */
>  #define SLAB_TYPESAFE_BY_RCU	((slab_flags_t __force)0x00080000U)
> -/* Spread some memory over cpuset */
> -#define SLAB_MEM_SPREAD		((slab_flags_t __force)0x00100000U)
>  /* Trace allocations and frees */
>  #define SLAB_TRACE		((slab_flags_t __force)0x00200000U)
>  
> @@ -164,6 +162,9 @@
>  #endif
>  #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */
>  
> +/* Obsolete unused flag, to be removed */
> +#define SLAB_MEM_SPREAD		0
> +
>  /*
>   * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
>   *
> diff --git a/mm/slab.h b/mm/slab.h
> index 54deeb0428c6..f4534eefb35d 100644
> --- a/mm/slab.h
> +++ b/mm/slab.h
> @@ -469,7 +469,6 @@ static inline bool is_kmalloc_cache(struct kmem_cache *s)
>  			      SLAB_STORE_USER | \
>  			      SLAB_TRACE | \
>  			      SLAB_CONSISTENCY_CHECKS | \
> -			      SLAB_MEM_SPREAD | \
>  			      SLAB_NOLEAKTRACE | \
>  			      SLAB_RECLAIM_ACCOUNT | \
>  			      SLAB_TEMPORARY | \
> 


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

* Re: [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-20 16:58 ` [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags Vlastimil Babka
  2024-02-21  2:23   ` Song, Xiongwei
@ 2024-02-21  7:13   ` Chengming Zhou
  2024-02-21 18:33   ` Roman Gushchin
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: Chengming Zhou @ 2024-02-21  7:13 UTC (permalink / raw)
  To: Vlastimil Babka, Christoph Lameter, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Andrew Morton, Roman Gushchin, Hyeonggon Yoo,
	Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Vincenzo Frascino
  Cc: Zheng Yejian, Xiongwei Song, linux-mm, linux-kernel, kasan-dev

On 2024/2/21 00:58, Vlastimil Babka wrote:
> The values of SLAB_ cache creation flagsare defined by hand, which is
> tedious and error-prone. Use an enum to assign the bit number and a
> __SF_BIT() macro to #define the final flags.
> 
> This renumbers the flag values, which is OK as they are only used
> internally.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>

Thanks!

> ---
>  include/linux/slab.h | 81 ++++++++++++++++++++++++++++++++++++++--------------
>  mm/slub.c            |  6 ++--
>  2 files changed, 63 insertions(+), 24 deletions(-)
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 6252f44115c2..f893a132dd5a 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -21,29 +21,68 @@
>  #include <linux/cleanup.h>
>  #include <linux/hash.h>
>  
> +enum _slab_flag_bits {
> +	_SLAB_CONSISTENCY_CHECKS,
> +	_SLAB_RED_ZONE,
> +	_SLAB_POISON,
> +	_SLAB_KMALLOC,
> +	_SLAB_HWCACHE_ALIGN,
> +	_SLAB_CACHE_DMA,
> +	_SLAB_CACHE_DMA32,
> +	_SLAB_STORE_USER,
> +	_SLAB_PANIC,
> +	_SLAB_TYPESAFE_BY_RCU,
> +	_SLAB_TRACE,
> +#ifdef CONFIG_DEBUG_OBJECTS
> +	_SLAB_DEBUG_OBJECTS,
> +#endif
> +	_SLAB_NOLEAKTRACE,
> +	_SLAB_NO_MERGE,
> +#ifdef CONFIG_FAILSLAB
> +	_SLAB_FAILSLAB,
> +#endif
> +#ifdef CONFIG_MEMCG_KMEM
> +	_SLAB_ACCOUNT,
> +#endif
> +#ifdef CONFIG_KASAN_GENERIC
> +	_SLAB_KASAN,
> +#endif
> +	_SLAB_NO_USER_FLAGS,
> +#ifdef CONFIG_KFENCE
> +	_SLAB_SKIP_KFENCE,
> +#endif
> +#ifndef CONFIG_SLUB_TINY
> +	_SLAB_RECLAIM_ACCOUNT,
> +#endif
> +	_SLAB_OBJECT_POISON,
> +	_SLAB_CMPXCHG_DOUBLE,
> +	_SLAB_FLAGS_LAST_BIT
> +};
> +
> +#define __SF_BIT(nr)	((slab_flags_t __force)(1U << (nr)))
>  
>  /*
>   * Flags to pass to kmem_cache_create().
>   * The ones marked DEBUG need CONFIG_SLUB_DEBUG enabled, otherwise are no-op
>   */
>  /* DEBUG: Perform (expensive) checks on alloc/free */
> -#define SLAB_CONSISTENCY_CHECKS	((slab_flags_t __force)0x00000100U)
> +#define SLAB_CONSISTENCY_CHECKS	__SF_BIT(_SLAB_CONSISTENCY_CHECKS)
>  /* DEBUG: Red zone objs in a cache */
> -#define SLAB_RED_ZONE		((slab_flags_t __force)0x00000400U)
> +#define SLAB_RED_ZONE		__SF_BIT(_SLAB_RED_ZONE)
>  /* DEBUG: Poison objects */
> -#define SLAB_POISON		((slab_flags_t __force)0x00000800U)
> +#define SLAB_POISON		__SF_BIT(_SLAB_POISON)
>  /* Indicate a kmalloc slab */
> -#define SLAB_KMALLOC		((slab_flags_t __force)0x00001000U)
> +#define SLAB_KMALLOC		__SF_BIT(_SLAB_KMALLOC)
>  /* Align objs on cache lines */
> -#define SLAB_HWCACHE_ALIGN	((slab_flags_t __force)0x00002000U)
> +#define SLAB_HWCACHE_ALIGN	__SF_BIT(_SLAB_HWCACHE_ALIGN)
>  /* Use GFP_DMA memory */
> -#define SLAB_CACHE_DMA		((slab_flags_t __force)0x00004000U)
> +#define SLAB_CACHE_DMA		__SF_BIT(_SLAB_CACHE_DMA)
>  /* Use GFP_DMA32 memory */
> -#define SLAB_CACHE_DMA32	((slab_flags_t __force)0x00008000U)
> +#define SLAB_CACHE_DMA32	__SF_BIT(_SLAB_CACHE_DMA32)
>  /* DEBUG: Store the last owner for bug hunting */
> -#define SLAB_STORE_USER		((slab_flags_t __force)0x00010000U)
> +#define SLAB_STORE_USER		__SF_BIT(_SLAB_STORE_USER)
>  /* Panic if kmem_cache_create() fails */
> -#define SLAB_PANIC		((slab_flags_t __force)0x00040000U)
> +#define SLAB_PANIC		__SF_BIT(_SLAB_PANIC)
>  /*
>   * SLAB_TYPESAFE_BY_RCU - **WARNING** READ THIS!
>   *
> @@ -95,19 +134,19 @@
>   * Note that SLAB_TYPESAFE_BY_RCU was originally named SLAB_DESTROY_BY_RCU.
>   */
>  /* Defer freeing slabs to RCU */
> -#define SLAB_TYPESAFE_BY_RCU	((slab_flags_t __force)0x00080000U)
> +#define SLAB_TYPESAFE_BY_RCU	__SF_BIT(_SLAB_TYPESAFE_BY_RCU)
>  /* Trace allocations and frees */
> -#define SLAB_TRACE		((slab_flags_t __force)0x00200000U)
> +#define SLAB_TRACE		__SF_BIT(_SLAB_TRACE)
>  
>  /* Flag to prevent checks on free */
>  #ifdef CONFIG_DEBUG_OBJECTS
> -# define SLAB_DEBUG_OBJECTS	((slab_flags_t __force)0x00400000U)
> +# define SLAB_DEBUG_OBJECTS	__SF_BIT(_SLAB_DEBUG_OBJECTS)
>  #else
>  # define SLAB_DEBUG_OBJECTS	0
>  #endif
>  
>  /* Avoid kmemleak tracing */
> -#define SLAB_NOLEAKTRACE	((slab_flags_t __force)0x00800000U)
> +#define SLAB_NOLEAKTRACE	__SF_BIT(_SLAB_NOLEAKTRACE)
>  
>  /*
>   * Prevent merging with compatible kmem caches. This flag should be used
> @@ -119,23 +158,23 @@
>   * - performance critical caches, should be very rare and consulted with slab
>   *   maintainers, and not used together with CONFIG_SLUB_TINY
>   */
> -#define SLAB_NO_MERGE		((slab_flags_t __force)0x01000000U)
> +#define SLAB_NO_MERGE		__SF_BIT(_SLAB_NO_MERGE)
>  
>  /* Fault injection mark */
>  #ifdef CONFIG_FAILSLAB
> -# define SLAB_FAILSLAB		((slab_flags_t __force)0x02000000U)
> +# define SLAB_FAILSLAB		__SF_BIT(_SLAB_FAILSLAB)
>  #else
>  # define SLAB_FAILSLAB		0
>  #endif
>  /* Account to memcg */
>  #ifdef CONFIG_MEMCG_KMEM
> -# define SLAB_ACCOUNT		((slab_flags_t __force)0x04000000U)
> +# define SLAB_ACCOUNT		__SF_BIT(_SLAB_ACCOUNT)
>  #else
>  # define SLAB_ACCOUNT		0
>  #endif
>  
>  #ifdef CONFIG_KASAN_GENERIC
> -#define SLAB_KASAN		((slab_flags_t __force)0x08000000U)
> +#define SLAB_KASAN		__SF_BIT(_SLAB_KASAN)
>  #else
>  #define SLAB_KASAN		0
>  #endif
> @@ -145,10 +184,10 @@
>   * Intended for caches created for self-tests so they have only flags
>   * specified in the code and other flags are ignored.
>   */
> -#define SLAB_NO_USER_FLAGS	((slab_flags_t __force)0x10000000U)
> +#define SLAB_NO_USER_FLAGS	__SF_BIT(_SLAB_NO_USER_FLAGS)
>  
>  #ifdef CONFIG_KFENCE
> -#define SLAB_SKIP_KFENCE	((slab_flags_t __force)0x20000000U)
> +#define SLAB_SKIP_KFENCE	__SF_BIT(_SLAB_SKIP_KFENCE)
>  #else
>  #define SLAB_SKIP_KFENCE	0
>  #endif
> @@ -156,9 +195,9 @@
>  /* The following flags affect the page allocator grouping pages by mobility */
>  /* Objects are reclaimable */
>  #ifndef CONFIG_SLUB_TINY
> -#define SLAB_RECLAIM_ACCOUNT	((slab_flags_t __force)0x00020000U)
> +#define SLAB_RECLAIM_ACCOUNT	__SF_BIT(_SLAB_RECLAIM_ACCOUNT)
>  #else
> -#define SLAB_RECLAIM_ACCOUNT	((slab_flags_t __force)0)
> +#define SLAB_RECLAIM_ACCOUNT	0
>  #endif
>  #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */
>  
> diff --git a/mm/slub.c b/mm/slub.c
> index 2ef88bbf56a3..a93c5a17cbbb 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -306,13 +306,13 @@ static inline bool kmem_cache_has_cpu_partial(struct kmem_cache *s)
>  
>  /* Internal SLUB flags */
>  /* Poison object */
> -#define __OBJECT_POISON		((slab_flags_t __force)0x80000000U)
> +#define __OBJECT_POISON		__SF_BIT(_SLAB_OBJECT_POISON)
>  /* Use cmpxchg_double */
>  
>  #ifdef system_has_freelist_aba
> -#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0x40000000U)
> +#define __CMPXCHG_DOUBLE	__SF_BIT(_SLAB_CMPXCHG_DOUBLE)
>  #else
> -#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0U)
> +#define __CMPXCHG_DOUBLE	0
>  #endif
>  
>  /*
> 


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

* Re: [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE
  2024-02-20 16:58 ` [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE Vlastimil Babka
  2024-02-21  2:25   ` Song, Xiongwei
@ 2024-02-21  7:14   ` Chengming Zhou
  2024-02-21 20:48   ` Andrey Konovalov
  2 siblings, 0 replies; 23+ messages in thread
From: Chengming Zhou @ 2024-02-21  7:14 UTC (permalink / raw)
  To: Vlastimil Babka, Christoph Lameter, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Andrew Morton, Roman Gushchin, Hyeonggon Yoo,
	Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Vincenzo Frascino
  Cc: Zheng Yejian, Xiongwei Song, linux-mm, linux-kernel, kasan-dev

On 2024/2/21 00:58, Vlastimil Babka wrote:
> The SLAB_KASAN flag prevents merging of caches in some configurations,
> which is handled in a rather complicated way via kasan_never_merge().
> Since we now have a generic SLAB_NO_MERGE flag, we can instead use it
> for KASAN caches in addition to SLAB_KASAN in those configurations,
> and simplify the SLAB_NEVER_MERGE handling.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>

Thanks!

> ---
>  include/linux/kasan.h |  6 ------
>  mm/kasan/generic.c    | 16 ++++------------
>  mm/slab_common.c      |  2 +-
>  3 files changed, 5 insertions(+), 19 deletions(-)
> 
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index dbb06d789e74..70d6a8f6e25d 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -429,7 +429,6 @@ struct kasan_cache {
>  };
>  
>  size_t kasan_metadata_size(struct kmem_cache *cache, bool in_object);
> -slab_flags_t kasan_never_merge(void);
>  void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
>  			slab_flags_t *flags);
>  
> @@ -446,11 +445,6 @@ static inline size_t kasan_metadata_size(struct kmem_cache *cache,
>  {
>  	return 0;
>  }
> -/* And thus nothing prevents cache merging. */
> -static inline slab_flags_t kasan_never_merge(void)
> -{
> -	return 0;
> -}
>  /* And no cache-related metadata initialization is required. */
>  static inline void kasan_cache_create(struct kmem_cache *cache,
>  				      unsigned int *size,
> diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> index df6627f62402..d8b78d273b9f 100644
> --- a/mm/kasan/generic.c
> +++ b/mm/kasan/generic.c
> @@ -334,14 +334,6 @@ DEFINE_ASAN_SET_SHADOW(f3);
>  DEFINE_ASAN_SET_SHADOW(f5);
>  DEFINE_ASAN_SET_SHADOW(f8);
>  
> -/* Only allow cache merging when no per-object metadata is present. */
> -slab_flags_t kasan_never_merge(void)
> -{
> -	if (!kasan_requires_meta())
> -		return 0;
> -	return SLAB_KASAN;
> -}
> -
>  /*
>   * Adaptive redzone policy taken from the userspace AddressSanitizer runtime.
>   * For larger allocations larger redzones are used.
> @@ -372,13 +364,13 @@ void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
>  	/*
>  	 * SLAB_KASAN is used to mark caches that are sanitized by KASAN
>  	 * and that thus have per-object metadata.
> -	 * Currently this flag is used in two places:
> +	 * Currently this flag is used in one place:
>  	 * 1. In slab_ksize() to account for per-object metadata when
>  	 *    calculating the size of the accessible memory within the object.
> -	 * 2. In slab_common.c via kasan_never_merge() to prevent merging of
> -	 *    caches with per-object metadata.
> +	 * Additionally, we use SLAB_NO_MERGE to prevent merging of caches
> +	 * with per-object metadata.
>  	 */
> -	*flags |= SLAB_KASAN;
> +	*flags |= SLAB_KASAN | SLAB_NO_MERGE;
>  
>  	ok_size = *size;
>  
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 238293b1dbe1..7cfa2f1ce655 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -50,7 +50,7 @@ static DECLARE_WORK(slab_caches_to_rcu_destroy_work,
>   */
>  #define SLAB_NEVER_MERGE (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
>  		SLAB_TRACE | SLAB_TYPESAFE_BY_RCU | SLAB_NOLEAKTRACE | \
> -		SLAB_FAILSLAB | SLAB_NO_MERGE | kasan_never_merge())
> +		SLAB_FAILSLAB | SLAB_NO_MERGE)
>  
>  #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | \
>  			 SLAB_CACHE_DMA32 | SLAB_ACCOUNT)
> 


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

* Re: [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-20 16:58 ` [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag Vlastimil Babka
  2024-02-21  2:17   ` Song, Xiongwei
  2024-02-21  7:11   ` Chengming Zhou
@ 2024-02-21 18:30   ` Roman Gushchin
  2024-02-22  1:10     ` Song, Xiongwei
  2 siblings, 1 reply; 23+ messages in thread
From: Roman Gushchin @ 2024-02-21 18:30 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, Xiongwei Song, Chengming Zhou,
	linux-mm, linux-kernel, kasan-dev, Steven Rostedt

On Tue, Feb 20, 2024 at 05:58:25PM +0100, Vlastimil Babka wrote:
0;95;0c> The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
> removed.  SLUB instead relies on the page allocator's NUMA policies.
> Change the flag's value to 0 to free up the value it had, and mark it
> for full removal once all users are gone.
> 
> Reported-by: Steven Rostedt <rostedt@goodmis.org>
> Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>

Do you plan to follow up with a patch series removing all usages?

Thanks!


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

* Re: [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-20 16:58 ` [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags Vlastimil Babka
  2024-02-21  2:23   ` Song, Xiongwei
  2024-02-21  7:13   ` Chengming Zhou
@ 2024-02-21 18:33   ` Roman Gushchin
  2024-02-23 16:42     ` Vlastimil Babka
  2024-02-21 22:19   ` Vlastimil Babka
  2024-02-23  3:12   ` Christoph Lameter (Ampere)
  4 siblings, 1 reply; 23+ messages in thread
From: Roman Gushchin @ 2024-02-21 18:33 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, Xiongwei Song, Chengming Zhou,
	linux-mm, linux-kernel, kasan-dev

On Tue, Feb 20, 2024 at 05:58:26PM +0100, Vlastimil Babka wrote:
> The values of SLAB_ cache creation flagsare defined by hand, which is
> tedious and error-prone. Use an enum to assign the bit number and a
> __SF_BIT() macro to #define the final flags.
> 
> This renumbers the flag values, which is OK as they are only used
> internally.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---
>  include/linux/slab.h | 81 ++++++++++++++++++++++++++++++++++++++--------------
>  mm/slub.c            |  6 ++--
>  2 files changed, 63 insertions(+), 24 deletions(-)
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 6252f44115c2..f893a132dd5a 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -21,29 +21,68 @@
>  #include <linux/cleanup.h>
>  #include <linux/hash.h>
>  
> +enum _slab_flag_bits {
> +	_SLAB_CONSISTENCY_CHECKS,
> +	_SLAB_RED_ZONE,
> +	_SLAB_POISON,
> +	_SLAB_KMALLOC,
> +	_SLAB_HWCACHE_ALIGN,
> +	_SLAB_CACHE_DMA,
> +	_SLAB_CACHE_DMA32,
> +	_SLAB_STORE_USER,
> +	_SLAB_PANIC,
> +	_SLAB_TYPESAFE_BY_RCU,
> +	_SLAB_TRACE,
> +#ifdef CONFIG_DEBUG_OBJECTS
> +	_SLAB_DEBUG_OBJECTS,
> +#endif
> +	_SLAB_NOLEAKTRACE,
> +	_SLAB_NO_MERGE,
> +#ifdef CONFIG_FAILSLAB
> +	_SLAB_FAILSLAB,
> +#endif
> +#ifdef CONFIG_MEMCG_KMEM
> +	_SLAB_ACCOUNT,
> +#endif
> +#ifdef CONFIG_KASAN_GENERIC
> +	_SLAB_KASAN,
> +#endif
> +	_SLAB_NO_USER_FLAGS,
> +#ifdef CONFIG_KFENCE
> +	_SLAB_SKIP_KFENCE,
> +#endif
> +#ifndef CONFIG_SLUB_TINY
> +	_SLAB_RECLAIM_ACCOUNT,
> +#endif
> +	_SLAB_OBJECT_POISON,
> +	_SLAB_CMPXCHG_DOUBLE,
> +	_SLAB_FLAGS_LAST_BIT
> +};
> +
> +#define __SF_BIT(nr)	((slab_flags_t __force)(1U << (nr)))

I'd rename it to (__)SLAB_FLAG_BIT(), as SF is a bit cryptic, but not a strong
preference. Otherwise looks really good to me, nice cleanup.

Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!


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

* Re: [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE
  2024-02-20 16:58 ` [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE Vlastimil Babka
  2024-02-21  2:25   ` Song, Xiongwei
  2024-02-21  7:14   ` Chengming Zhou
@ 2024-02-21 20:48   ` Andrey Konovalov
  2 siblings, 0 replies; 23+ messages in thread
From: Andrey Konovalov @ 2024-02-21 20:48 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Vincenzo Frascino,
	Zheng Yejian, Xiongwei Song, Chengming Zhou, linux-mm,
	linux-kernel, kasan-dev

On Tue, Feb 20, 2024 at 5:58 PM Vlastimil Babka <vbabka@suse.cz> wrote:
>
> The SLAB_KASAN flag prevents merging of caches in some configurations,
> which is handled in a rather complicated way via kasan_never_merge().
> Since we now have a generic SLAB_NO_MERGE flag, we can instead use it
> for KASAN caches in addition to SLAB_KASAN in those configurations,
> and simplify the SLAB_NEVER_MERGE handling.
>
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---
>  include/linux/kasan.h |  6 ------
>  mm/kasan/generic.c    | 16 ++++------------
>  mm/slab_common.c      |  2 +-
>  3 files changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index dbb06d789e74..70d6a8f6e25d 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -429,7 +429,6 @@ struct kasan_cache {
>  };
>
>  size_t kasan_metadata_size(struct kmem_cache *cache, bool in_object);
> -slab_flags_t kasan_never_merge(void);
>  void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
>                         slab_flags_t *flags);
>
> @@ -446,11 +445,6 @@ static inline size_t kasan_metadata_size(struct kmem_cache *cache,
>  {
>         return 0;
>  }
> -/* And thus nothing prevents cache merging. */
> -static inline slab_flags_t kasan_never_merge(void)
> -{
> -       return 0;
> -}
>  /* And no cache-related metadata initialization is required. */
>  static inline void kasan_cache_create(struct kmem_cache *cache,
>                                       unsigned int *size,
> diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> index df6627f62402..d8b78d273b9f 100644
> --- a/mm/kasan/generic.c
> +++ b/mm/kasan/generic.c
> @@ -334,14 +334,6 @@ DEFINE_ASAN_SET_SHADOW(f3);
>  DEFINE_ASAN_SET_SHADOW(f5);
>  DEFINE_ASAN_SET_SHADOW(f8);
>
> -/* Only allow cache merging when no per-object metadata is present. */
> -slab_flags_t kasan_never_merge(void)
> -{
> -       if (!kasan_requires_meta())
> -               return 0;
> -       return SLAB_KASAN;
> -}
> -
>  /*
>   * Adaptive redzone policy taken from the userspace AddressSanitizer runtime.
>   * For larger allocations larger redzones are used.
> @@ -372,13 +364,13 @@ void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
>         /*
>          * SLAB_KASAN is used to mark caches that are sanitized by KASAN
>          * and that thus have per-object metadata.
> -        * Currently this flag is used in two places:
> +        * Currently this flag is used in one place:
>          * 1. In slab_ksize() to account for per-object metadata when
>          *    calculating the size of the accessible memory within the object.
> -        * 2. In slab_common.c via kasan_never_merge() to prevent merging of
> -        *    caches with per-object metadata.

Let's reword this to:

SLAB_KASAN is used to mark caches that are sanitized by KASAN and that
thus have per-object metadata. Currently, this flag is used in
slab_ksize() to account for per-object metadata when calculating the
size of the accessible memory within the object.

> +        * Additionally, we use SLAB_NO_MERGE to prevent merging of caches
> +        * with per-object metadata.
>          */
> -       *flags |= SLAB_KASAN;
> +       *flags |= SLAB_KASAN | SLAB_NO_MERGE;
>
>         ok_size = *size;
>
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 238293b1dbe1..7cfa2f1ce655 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -50,7 +50,7 @@ static DECLARE_WORK(slab_caches_to_rcu_destroy_work,
>   */
>  #define SLAB_NEVER_MERGE (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
>                 SLAB_TRACE | SLAB_TYPESAFE_BY_RCU | SLAB_NOLEAKTRACE | \
> -               SLAB_FAILSLAB | SLAB_NO_MERGE | kasan_never_merge())
> +               SLAB_FAILSLAB | SLAB_NO_MERGE)
>
>  #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | \
>                          SLAB_CACHE_DMA32 | SLAB_ACCOUNT)
>
> --
> 2.43.1
>

Otherwise, looks good to me.

Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>

Thanks!


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

* Re: [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-20 16:58 ` [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags Vlastimil Babka
                     ` (2 preceding siblings ...)
  2024-02-21 18:33   ` Roman Gushchin
@ 2024-02-21 22:19   ` Vlastimil Babka
  2024-02-23  3:12   ` Christoph Lameter (Ampere)
  4 siblings, 0 replies; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-21 22:19 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino
  Cc: Zheng Yejian, Xiongwei Song, Chengming Zhou, linux-mm,
	linux-kernel, kasan-dev

On 2/20/24 17:58, Vlastimil Babka wrote:
> @@ -156,9 +195,9 @@
>  /* The following flags affect the page allocator grouping pages by mobility */
>  /* Objects are reclaimable */
>  #ifndef CONFIG_SLUB_TINY
> -#define SLAB_RECLAIM_ACCOUNT ((slab_flags_t __force)0x00020000U)
> +#define SLAB_RECLAIM_ACCOUNT __SF_BIT(_SLAB_RECLAIM_ACCOUNT)
>  #else
> -#define SLAB_RECLAIM_ACCOUNT ((slab_flags_t __force)0)
> +#define SLAB_RECLAIM_ACCOUNT 0

lkp/sparse tells me this was the wrong way to unify all noop-due-to-config
flags [1,2]

so in v2 I'll unify all those to
((slab_flags_t __force)0U)

also the deprecated SLAB_MEM_SPREAD in patch 1

[1] https://lore.kernel.org/all/202402212310.KPtSDrRy-lkp@intel.com/
[2] https://lore.kernel.org/all/202402211803.Lmf1ANXx-lkp@intel.com/


>  #endif
>  #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */




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

* RE: [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-21 18:30   ` Roman Gushchin
@ 2024-02-22  1:10     ` Song, Xiongwei
  2024-02-22  2:32       ` Chengming Zhou
  0 siblings, 1 reply; 23+ messages in thread
From: Song, Xiongwei @ 2024-02-22  1:10 UTC (permalink / raw)
  To: Roman Gushchin, Vlastimil Babka
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, Chengming Zhou, linux-mm,
	linux-kernel, kasan-dev, Steven Rostedt

Hi Vlastimil,

> On Tue, Feb 20, 2024 at 05:58:25PM +0100, Vlastimil Babka wrote:
> 0;95;0c> The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
> > removed.  SLUB instead relies on the page allocator's NUMA policies.
> > Change the flag's value to 0 to free up the value it had, and mark it
> > for full removal once all users are gone.
> >
> > Reported-by: Steven Rostedt <rostedt@goodmis.org>
> > Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
> > Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> 
> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
> 
> Do you plan to follow up with a patch series removing all usages?

If you are not available with it, I can do.

Regards,
Xiongwei



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

* Re: [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-22  1:10     ` Song, Xiongwei
@ 2024-02-22  2:32       ` Chengming Zhou
  2024-02-22  3:13         ` Song, Xiongwei
  2024-02-23 16:41         ` Vlastimil Babka
  0 siblings, 2 replies; 23+ messages in thread
From: Chengming Zhou @ 2024-02-22  2:32 UTC (permalink / raw)
  To: Song, Xiongwei, Roman Gushchin, Vlastimil Babka
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, linux-mm, linux-kernel,
	kasan-dev, Steven Rostedt

On 2024/2/22 09:10, Song, Xiongwei wrote:
> Hi Vlastimil,
> 
>> On Tue, Feb 20, 2024 at 05:58:25PM +0100, Vlastimil Babka wrote:
>> 0;95;0c> The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
>>> removed.  SLUB instead relies on the page allocator's NUMA policies.
>>> Change the flag's value to 0 to free up the value it had, and mark it
>>> for full removal once all users are gone.
>>>
>>> Reported-by: Steven Rostedt <rostedt@goodmis.org>
>>> Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
>>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>>
>> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
>>
>> Do you plan to follow up with a patch series removing all usages?
> 
> If you are not available with it, I can do.

Actually, I have done it yesterday. Sorry, I just forgot this task. :)

I plan to send out it after this series merged in the slab branch. And
I'm wondering is it better to put all diffs in one huge patch or split
every diff to each patch?

Thanks!


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

* RE: [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-22  2:32       ` Chengming Zhou
@ 2024-02-22  3:13         ` Song, Xiongwei
  2024-02-23 16:41         ` Vlastimil Babka
  1 sibling, 0 replies; 23+ messages in thread
From: Song, Xiongwei @ 2024-02-22  3:13 UTC (permalink / raw)
  To: Chengming Zhou, Roman Gushchin, Vlastimil Babka
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, linux-mm, linux-kernel,
	kasan-dev, Steven Rostedt

> On 2024/2/22 09:10, Song, Xiongwei wrote:
> > Hi Vlastimil,
> >
> >> On Tue, Feb 20, 2024 at 05:58:25PM +0100, Vlastimil Babka wrote:
> >> 0;95;0c> The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
> >>> removed.  SLUB instead relies on the page allocator's NUMA policies.
> >>> Change the flag's value to 0 to free up the value it had, and mark it
> >>> for full removal once all users are gone.
> >>>
> >>> Reported-by: Steven Rostedt <rostedt@goodmis.org>
> >>> Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
> >>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> >>
> >> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
> >>
> >> Do you plan to follow up with a patch series removing all usages?
> >
> > If you are not available with it, I can do.
> 
> Actually, I have done it yesterday. Sorry, I just forgot this task. :)

Ok, that's fine.

I remember you said you wanted to do it. But it's been for a long time.
I thinks that's why Vlastimil sent the series out. 

You could've said what you've done or your any update when you reviewed
this series yesterday, which wouldn't make others confused. So keeping 
update would be better.

Thanks.

> 
> I plan to send out it after this series merged in the slab branch. And
> I'm wondering is it better to put all diffs in one huge patch or split
> every diff to each patch?
> 
> Thanks!

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

* Re: [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-20 16:58 ` [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags Vlastimil Babka
                     ` (3 preceding siblings ...)
  2024-02-21 22:19   ` Vlastimil Babka
@ 2024-02-23  3:12   ` Christoph Lameter (Ampere)
  2024-02-23 16:43     ` Vlastimil Babka
  4 siblings, 1 reply; 23+ messages in thread
From: Christoph Lameter (Ampere) @ 2024-02-23  3:12 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton,
	Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, Xiongwei Song, Chengming Zhou,
	linux-mm, linux-kernel, kasan-dev

On Tue, 20 Feb 2024, Vlastimil Babka wrote:

> diff --git a/mm/slub.c b/mm/slub.c
> index 2ef88bbf56a3..a93c5a17cbbb 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -306,13 +306,13 @@ static inline bool kmem_cache_has_cpu_partial(struct kmem_cache *s)
>
> /* Internal SLUB flags */
> /* Poison object */
> -#define __OBJECT_POISON		((slab_flags_t __force)0x80000000U)
> +#define __OBJECT_POISON		__SF_BIT(_SLAB_OBJECT_POISON)
> /* Use cmpxchg_double */
>
> #ifdef system_has_freelist_aba
> -#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0x40000000U)
> +#define __CMPXCHG_DOUBLE	__SF_BIT(_SLAB_CMPXCHG_DOUBLE)
> #else
> -#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0U)
> +#define __CMPXCHG_DOUBLE	0
> #endif

Maybe its good to put these internal flags together with the other flags. 
After all there is no other slab allocator available anymore and having 
them all together avoids confusion.



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

* Re: [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-22  2:32       ` Chengming Zhou
  2024-02-22  3:13         ` Song, Xiongwei
@ 2024-02-23 16:41         ` Vlastimil Babka
  2024-02-24  9:32           ` Chengming Zhou
  1 sibling, 1 reply; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-23 16:41 UTC (permalink / raw)
  To: Chengming Zhou, Song, Xiongwei, Roman Gushchin
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, linux-mm, linux-kernel,
	kasan-dev, Steven Rostedt

On 2/22/24 03:32, Chengming Zhou wrote:
> On 2024/2/22 09:10, Song, Xiongwei wrote:
>> Hi Vlastimil,
>> 
>>> On Tue, Feb 20, 2024 at 05:58:25PM +0100, Vlastimil Babka wrote:
>>> 0;95;0c> The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
>>>> removed.  SLUB instead relies on the page allocator's NUMA policies.
>>>> Change the flag's value to 0 to free up the value it had, and mark it
>>>> for full removal once all users are gone.
>>>>
>>>> Reported-by: Steven Rostedt <rostedt@goodmis.org>
>>>> Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
>>>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>>>
>>> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
>>>
>>> Do you plan to follow up with a patch series removing all usages?
>> 
>> If you are not available with it, I can do.
> 
> Actually, I have done it yesterday. Sorry, I just forgot this task. :)
> 
> I plan to send out it after this series merged in the slab branch. And
> I'm wondering is it better to put all diffs in one huge patch or split
> every diff to each patch?

I'd suggest you do a patch per subsystem (mostly different filesystems) and
send them out to respective maintainers to pick in their trees. I've talked
to David from btrfs and he suggested this way.

You don't need to wait for this series to be merged. The flag is already a
no-op as of 6.8-rc1. Also I'd suggest sending the patches individually. In a
series they wouldn't depend on each other anyway, and you would either have
to Cc maintainers separately per patch of the series, or everyone on
everything, and there would always be somebody who would prefer the other
way that you pick.

> Thanks!



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

* Re: [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-21 18:33   ` Roman Gushchin
@ 2024-02-23 16:42     ` Vlastimil Babka
  0 siblings, 0 replies; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-23 16:42 UTC (permalink / raw)
  To: Roman Gushchin
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, Xiongwei Song, Chengming Zhou,
	linux-mm, linux-kernel, kasan-dev

On 2/21/24 19:33, Roman Gushchin wrote:
> On Tue, Feb 20, 2024 at 05:58:26PM +0100, Vlastimil Babka wrote:
>> The values of SLAB_ cache creation flagsare defined by hand, which is
>> tedious and error-prone. Use an enum to assign the bit number and a
>> __SF_BIT() macro to #define the final flags.
>> 
>> This renumbers the flag values, which is OK as they are only used
>> internally.
>> 
>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>> +#define __SF_BIT(nr)	((slab_flags_t __force)(1U << (nr)))
> 
> I'd rename it to (__)SLAB_FLAG_BIT(), as SF is a bit cryptic, but not a strong
> preference. Otherwise looks really good to me, nice cleanup.

OK, it's also less likely that somebody would collide it.

> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
> 
> Thanks!



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

* Re: [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-23  3:12   ` Christoph Lameter (Ampere)
@ 2024-02-23 16:43     ` Vlastimil Babka
  2024-02-23 17:06       ` Vlastimil Babka
  0 siblings, 1 reply; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-23 16:43 UTC (permalink / raw)
  To: Christoph Lameter (Ampere)
  Cc: Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton,
	Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, Xiongwei Song, Chengming Zhou,
	linux-mm, linux-kernel, kasan-dev

On 2/23/24 04:12, Christoph Lameter (Ampere) wrote:
> On Tue, 20 Feb 2024, Vlastimil Babka wrote:
> 
>> diff --git a/mm/slub.c b/mm/slub.c
>> index 2ef88bbf56a3..a93c5a17cbbb 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -306,13 +306,13 @@ static inline bool kmem_cache_has_cpu_partial(struct kmem_cache *s)
>>
>> /* Internal SLUB flags */
>> /* Poison object */
>> -#define __OBJECT_POISON		((slab_flags_t __force)0x80000000U)
>> +#define __OBJECT_POISON		__SF_BIT(_SLAB_OBJECT_POISON)
>> /* Use cmpxchg_double */
>>
>> #ifdef system_has_freelist_aba
>> -#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0x40000000U)
>> +#define __CMPXCHG_DOUBLE	__SF_BIT(_SLAB_CMPXCHG_DOUBLE)
>> #else
>> -#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0U)
>> +#define __CMPXCHG_DOUBLE	0
>> #endif
> 
> Maybe its good to put these internal flags together with the other flags. 
> After all there is no other slab allocator available anymore and having 
> them all together avoids confusion.

Good poiint, will do. Then I can also #undef the helper macro after the last
flag.





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

* Re: [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags
  2024-02-23 16:43     ` Vlastimil Babka
@ 2024-02-23 17:06       ` Vlastimil Babka
  0 siblings, 0 replies; 23+ messages in thread
From: Vlastimil Babka @ 2024-02-23 17:06 UTC (permalink / raw)
  To: Christoph Lameter (Ampere)
  Cc: Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton,
	Roman Gushchin, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, Xiongwei Song, Chengming Zhou,
	linux-mm, linux-kernel, kasan-dev

On 2/23/24 17:43, Vlastimil Babka wrote:
> On 2/23/24 04:12, Christoph Lameter (Ampere) wrote:
>> On Tue, 20 Feb 2024, Vlastimil Babka wrote:
>> 
>>> diff --git a/mm/slub.c b/mm/slub.c
>>> index 2ef88bbf56a3..a93c5a17cbbb 100644
>>> --- a/mm/slub.c
>>> +++ b/mm/slub.c
>>> @@ -306,13 +306,13 @@ static inline bool kmem_cache_has_cpu_partial(struct kmem_cache *s)
>>>
>>> /* Internal SLUB flags */
>>> /* Poison object */
>>> -#define __OBJECT_POISON		((slab_flags_t __force)0x80000000U)
>>> +#define __OBJECT_POISON		__SF_BIT(_SLAB_OBJECT_POISON)
>>> /* Use cmpxchg_double */
>>>
>>> #ifdef system_has_freelist_aba

Hm but we only have this in the internal mm/slab.h

>>> -#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0x40000000U)
>>> +#define __CMPXCHG_DOUBLE	__SF_BIT(_SLAB_CMPXCHG_DOUBLE)
>>> #else
>>> -#define __CMPXCHG_DOUBLE	((slab_flags_t __force)0U)
>>> +#define __CMPXCHG_DOUBLE	0

And keeping the 0 is desirable to make the checks compile-time false when
it's not available.

So maybe it's best if it stays here after all, or we'd pull too much of
internal details into the "public" slab.h

>>> #endif
>> 
>> Maybe its good to put these internal flags together with the other flags. 
>> After all there is no other slab allocator available anymore and having 
>> them all together avoids confusion.
> 
> Good poiint, will do. Then I can also #undef the helper macro after the last
> flag.
> 
> 
> 



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

* Re: [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag
  2024-02-23 16:41         ` Vlastimil Babka
@ 2024-02-24  9:32           ` Chengming Zhou
  0 siblings, 0 replies; 23+ messages in thread
From: Chengming Zhou @ 2024-02-24  9:32 UTC (permalink / raw)
  To: Vlastimil Babka, Song, Xiongwei, Roman Gushchin
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Hyeonggon Yoo, Andrey Ryabinin,
	Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov,
	Vincenzo Frascino, Zheng Yejian, linux-mm, linux-kernel,
	kasan-dev, Steven Rostedt

On 2024/2/24 00:41, Vlastimil Babka wrote:
> On 2/22/24 03:32, Chengming Zhou wrote:
>> On 2024/2/22 09:10, Song, Xiongwei wrote:
>>> Hi Vlastimil,
>>>
>>>> On Tue, Feb 20, 2024 at 05:58:25PM +0100, Vlastimil Babka wrote:
>>>> 0;95;0c> The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
>>>>> removed.  SLUB instead relies on the page allocator's NUMA policies.
>>>>> Change the flag's value to 0 to free up the value it had, and mark it
>>>>> for full removal once all users are gone.
>>>>>
>>>>> Reported-by: Steven Rostedt <rostedt@goodmis.org>
>>>>> Closes: https://lore.kernel.org/all/20240131172027.10f64405@gandalf.local.home/
>>>>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>>>>
>>>> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
>>>>
>>>> Do you plan to follow up with a patch series removing all usages?
>>>
>>> If you are not available with it, I can do.
>>
>> Actually, I have done it yesterday. Sorry, I just forgot this task. :)
>>
>> I plan to send out it after this series merged in the slab branch. And
>> I'm wondering is it better to put all diffs in one huge patch or split
>> every diff to each patch?
> 
> I'd suggest you do a patch per subsystem (mostly different filesystems) and
> send them out to respective maintainers to pick in their trees. I've talked
> to David from btrfs and he suggested this way.

Ok, will send out individually.

> 
> You don't need to wait for this series to be merged. The flag is already a
> no-op as of 6.8-rc1. Also I'd suggest sending the patches individually. In a
> series they wouldn't depend on each other anyway, and you would either have
> to Cc maintainers separately per patch of the series, or everyone on
> everything, and there would always be somebody who would prefer the other
> way that you pick.

Right, thanks for your instructions!

> 
>> Thanks!
> 


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

end of thread, other threads:[~2024-02-24  9:33 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 16:58 [PATCH 0/3] cleanup of SLAB_ flags Vlastimil Babka
2024-02-20 16:58 ` [PATCH 1/3] mm, slab: deprecate SLAB_MEM_SPREAD flag Vlastimil Babka
2024-02-21  2:17   ` Song, Xiongwei
2024-02-21  7:11   ` Chengming Zhou
2024-02-21 18:30   ` Roman Gushchin
2024-02-22  1:10     ` Song, Xiongwei
2024-02-22  2:32       ` Chengming Zhou
2024-02-22  3:13         ` Song, Xiongwei
2024-02-23 16:41         ` Vlastimil Babka
2024-02-24  9:32           ` Chengming Zhou
2024-02-20 16:58 ` [PATCH 2/3] mm, slab: use an enum to define SLAB_ cache creation flags Vlastimil Babka
2024-02-21  2:23   ` Song, Xiongwei
2024-02-21  7:13   ` Chengming Zhou
2024-02-21 18:33   ` Roman Gushchin
2024-02-23 16:42     ` Vlastimil Babka
2024-02-21 22:19   ` Vlastimil Babka
2024-02-23  3:12   ` Christoph Lameter (Ampere)
2024-02-23 16:43     ` Vlastimil Babka
2024-02-23 17:06       ` Vlastimil Babka
2024-02-20 16:58 ` [PATCH 3/3] mm, slab, kasan: replace kasan_never_merge() with SLAB_NO_MERGE Vlastimil Babka
2024-02-21  2:25   ` Song, Xiongwei
2024-02-21  7:14   ` Chengming Zhou
2024-02-21 20:48   ` Andrey Konovalov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox