]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge branch 'slab/for-6.19/freelist_aba_t_cleanups' into slab/for-next
authorVlastimil Babka <vbabka@suse.cz>
Tue, 25 Nov 2025 13:35:33 +0000 (14:35 +0100)
committerVlastimil Babka <vbabka@suse.cz>
Tue, 25 Nov 2025 13:35:33 +0000 (14:35 +0100)
Merge series "slab: cmpxchg cleanups enabled by -fms-extensions"

From the cover letter [1]:

After learning about -fms-extensions being enabled for 6.19, I realized
there is some cleanup potential in slub code by extending the definition
and usage of freelist_aba_t, as it can now become an unnamed member of
struct slab. This series performs the cleanup, with no functional
changes intended. Additionally we turn freelist_aba_t to struct
freelist_counters as it doesn't meet any criteria for being a typedef,
per Documentation/process/coding-style.rst

Based on the tag kbuild-ms-extensions-6.19 from
git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linuxV

Link: https://lore.kernel.org/all/20251107-slab-fms-cleanup-v1-0-650b1491ac9e@suse.cz/#t
1  2 
Makefile
mm/slab.h
mm/slub.c

diff --cc Makefile
Simple merge
diff --cc mm/slab.h
index 8430e24bba3bc3fa355f8c191e6c0c435f9ee772,42627b87d50ca4845608935a75fd7eb4b27d8892..f730e012553ccd104e89351a238afedb9b557ee2
+++ b/mm/slab.h
@@@ -114,9 -110,22 +110,9 @@@ SLAB_MATCH(_unused_slab_obj_exts, obj_e
  #undef SLAB_MATCH
  static_assert(sizeof(struct slab) <= sizeof(struct page));
  #if defined(system_has_freelist_aba)
- static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(freelist_aba_t)));
+ static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(struct freelist_counters)));
  #endif
  
 -/**
 - * folio_slab - Converts from folio to slab.
 - * @folio: The folio.
 - *
 - * Currently struct slab is a different representation of a folio where
 - * folio_test_slab() is true.
 - *
 - * Return: The slab which contains this folio.
 - */
 -#define folio_slab(folio)     (_Generic((folio),                      \
 -      const struct folio *:   (const struct slab *)(folio),           \
 -      struct folio *:         (struct slab *)(folio)))
 -
  /**
   * slab_folio - The folio allocated for a slab
   * @s: The slab.
diff --cc mm/slub.c
index 4de428d9e76d203652c151aa87c17799a9f4db41,ddd71f4937fa2b68172df7b5c8001f1d6291f1df..785e25a149997b0cea90dd025e92b79323093554
+++ b/mm/slub.c
@@@ -410,18 -410,23 +410,22 @@@ enum stat_item 
        NR_SLUB_STAT_ITEMS
  };
  
- /*
-  * When changing the layout, make sure freelist and tid are still compatible
-  * with this_cpu_cmpxchg_double() alignment requirements.
-  */
- struct kmem_cache_cpu {
 -#ifndef CONFIG_SLUB_TINY
+ struct freelist_tid {
        union {
                struct {
-                       void **freelist;        /* Pointer to next available object */
+                       void *freelist;         /* Pointer to next available object */
                        unsigned long tid;      /* Globally unique transaction id */
                };
-               freelist_aba_t freelist_tid;
+               freelist_full_t freelist_tid;
        };
+ };
+ /*
+  * When changing the layout, make sure freelist and tid are still compatible
+  * with this_cpu_cmpxchg_double() alignment requirements.
+  */
+ struct kmem_cache_cpu {
+       struct freelist_tid;
        struct slab *slab;      /* The slab from which we are allocating */
  #ifdef CONFIG_SLUB_CPU_PARTIAL
        struct slab *partial;   /* Partially allocated slabs */