Re: [PATCH 2/4] slab: turn freelist_aba_t to a struct and fully define counters there
From: Harry Yoo
Date: Thu Nov 13 2025 - 02:34:35 EST
On Fri, Nov 07, 2025 at 02:51:24PM +0100, Vlastimil Babka wrote:
> In struct slab we currently have freelist and counters pair, where
> counters itself is a union of unsigned long with a sub-struct of
> several smaller fields. Then for the usage with double cmpxchg we have
> freelist_aba_t that duplicates the definition of the freelist+counters
> with implicitly the same layout as the full definition in struct slab.
>
> Thanks to -fms-extension we can now move the full counters definition to
> freelist_aba_t (while changing it to struct freelist_counters as a
> typedef is unnecessary and discouraged) and replace the relevant part in
> struct slab to an unnamed reference to it.
>
> The immediate benefit is the removal of duplication and no longer
> relying on the same layout implicitly. It also allows further cleanups
> thanks to having the full definition of counters in struct
> freelist_counters.
>
> Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
Nice cleanup!
Looks good to me,
Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>
--
Cheers,
Harry / Hyeonggon