From: Vlastimil Babka Date: Tue, 25 Nov 2025 13:35:33 +0000 (+0100) Subject: Merge branch 'slab/for-6.19/freelist_aba_t_cleanups' into slab/for-next X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed80cc758b784a1ed297f9130625de217a904ba5;p=thirdparty%2Flinux.git Merge branch 'slab/for-6.19/freelist_aba_t_cleanups' into slab/for-next 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] --- ed80cc758b784a1ed297f9130625de217a904ba5 diff --cc mm/slab.h index 8430e24bba3bc,42627b87d50ca..f730e012553cc --- a/mm/slab.h +++ 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 4de428d9e76d2,ddd71f4937fa2..785e25a149997 --- a/mm/slub.c +++ 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 */