summaryrefslogtreecommitdiff
path: root/mm/slub.c
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2025-11-07 14:51:24 +0100
committerVlastimil Babka <vbabka@suse.cz>2025-11-10 15:35:21 +0100
commit3993ca9d6495e1e4d6fdaffc1bba0271059940c4 (patch)
tree16033dc7e04f17ffcfb5bfdba411f3e3cda86326 /mm/slub.c
parentb244358e9a1cd61276b8785b1b4275f1f45a1dc2 (diff)
slab: turn freelist_aba_t to a struct and fully define counters there
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. Reviewed-by: Harry Yoo <harry.yoo@oracle.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 5f6408c9e0fd..8330e4f8b3b2 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -764,10 +764,12 @@ __update_freelist_fast(struct slab *slab,
void *freelist_new, unsigned long counters_new)
{
#ifdef system_has_freelist_aba
- freelist_aba_t old = { .freelist = freelist_old, .counter = counters_old };
- freelist_aba_t new = { .freelist = freelist_new, .counter = counters_new };
+ struct freelist_counters old = { .freelist = freelist_old, .counters = counters_old };
+ struct freelist_counters new = { .freelist = freelist_new, .counters = counters_new };
- return try_cmpxchg_freelist(&slab->freelist_counter.full, &old.full, new.full);
+ return try_cmpxchg_freelist(&slab->freelist_counters,
+ &old.freelist_counters,
+ new.freelist_counters);
#else
return false;
#endif