]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
slab: use memdesc_flags_t
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 5 Aug 2025 17:22:55 +0000 (18:22 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:07 +0000 (17:25 -0700)
The slab flags are memdesc flags and contain the same information in the
upper bits as the other memdescs (like node ID).

Link: https://lkml.kernel.org/r/20250805172307.1302730-6-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/slab.h
mm/slub.c

index 248b34c839b7ca39cf14e139c62d116efb97d30f..7757331e7c80f5276d058e0603d6dcb81a2607eb 100644 (file)
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -50,7 +50,7 @@ typedef union {
 
 /* Reuses the bits in struct page */
 struct slab {
-       unsigned long flags;
+       memdesc_flags_t flags;
 
        struct kmem_cache *slab_cache;
        union {
index 8dbeabc6a0f0199d4e1d45f15d802304be6c98af..af343ca570b57f714fbda892f51524fa2f68774a 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -657,17 +657,17 @@ static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s)
  */
 static inline bool slab_test_pfmemalloc(const struct slab *slab)
 {
-       return test_bit(SL_pfmemalloc, &slab->flags);
+       return test_bit(SL_pfmemalloc, &slab->flags.f);
 }
 
 static inline void slab_set_pfmemalloc(struct slab *slab)
 {
-       set_bit(SL_pfmemalloc, &slab->flags);
+       set_bit(SL_pfmemalloc, &slab->flags.f);
 }
 
 static inline void __slab_clear_pfmemalloc(struct slab *slab)
 {
-       __clear_bit(SL_pfmemalloc, &slab->flags);
+       __clear_bit(SL_pfmemalloc, &slab->flags.f);
 }
 
 /*
@@ -675,12 +675,12 @@ static inline void __slab_clear_pfmemalloc(struct slab *slab)
  */
 static __always_inline void slab_lock(struct slab *slab)
 {
-       bit_spin_lock(SL_locked, &slab->flags);
+       bit_spin_lock(SL_locked, &slab->flags.f);
 }
 
 static __always_inline void slab_unlock(struct slab *slab)
 {
-       bit_spin_unlock(SL_locked, &slab->flags);
+       bit_spin_unlock(SL_locked, &slab->flags.f);
 }
 
 static inline bool
@@ -1046,7 +1046,7 @@ static void print_slab_info(const struct slab *slab)
 {
        pr_err("Slab 0x%p objects=%u used=%u fp=0x%p flags=%pGp\n",
               slab, slab->objects, slab->inuse, slab->freelist,
-              &slab->flags);
+              &slab->flags.f);
 }
 
 void skip_orig_size_check(struct kmem_cache *s, const void *object)
@@ -2755,17 +2755,17 @@ static void discard_slab(struct kmem_cache *s, struct slab *slab)
 
 static inline bool slab_test_node_partial(const struct slab *slab)
 {
-       return test_bit(SL_partial, &slab->flags);
+       return test_bit(SL_partial, &slab->flags.f);
 }
 
 static inline void slab_set_node_partial(struct slab *slab)
 {
-       set_bit(SL_partial, &slab->flags);
+       set_bit(SL_partial, &slab->flags.f);
 }
 
 static inline void slab_clear_node_partial(struct slab *slab)
 {
-       clear_bit(SL_partial, &slab->flags);
+       clear_bit(SL_partial, &slab->flags.f);
 }
 
 /*