Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

slab: Rename slab->__page_flags to slab->flags

Slab has its own reasons for using flag bits; they aren't just
the page bits. Maybe this won't be the ultimate solution, but
we should be clear that these bits are in use.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://patch.msgid.link/20250611155916.2579160-3-willy@infradead.org
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

authored by

Matthew Wilcox (Oracle) and committed by
Vlastimil Babka
30908096 262e086f

+17 -5
+2 -2
mm/slab.h
··· 50 50 51 51 /* Reuses the bits in struct page */ 52 52 struct slab { 53 - unsigned long __page_flags; 53 + unsigned long flags; 54 54 55 55 struct kmem_cache *slab_cache; 56 56 union { ··· 99 99 100 100 #define SLAB_MATCH(pg, sl) \ 101 101 static_assert(offsetof(struct page, pg) == offsetof(struct slab, sl)) 102 - SLAB_MATCH(flags, __page_flags); 102 + SLAB_MATCH(flags, flags); 103 103 SLAB_MATCH(compound_head, slab_cache); /* Ensure bit 0 is clear */ 104 104 SLAB_MATCH(_refcount, __page_refcount); 105 105 #ifdef CONFIG_MEMCG
+15 -3
mm/slub.c
··· 183 183 * the fast path and disables lockless freelists. 184 184 */ 185 185 186 + /** 187 + * enum slab_flags - How the slab flags bits are used. 188 + * @SL_locked: Is locked with slab_lock() 189 + * 190 + * The slab flags share space with the page flags but some bits have 191 + * different interpretations. The high bits are used for information 192 + * like zone/node/section. 193 + */ 194 + enum slab_flags { 195 + SL_locked = PG_locked, 196 + }; 197 + 186 198 /* 187 199 * We could simply use migrate_disable()/enable() but as long as it's a 188 200 * function call even on !PREEMPT_RT, use inline preempt_disable() there. ··· 651 639 */ 652 640 static __always_inline void slab_lock(struct slab *slab) 653 641 { 654 - bit_spin_lock(PG_locked, &slab->__page_flags); 642 + bit_spin_lock(SL_locked, &slab->flags); 655 643 } 656 644 657 645 static __always_inline void slab_unlock(struct slab *slab) 658 646 { 659 - bit_spin_unlock(PG_locked, &slab->__page_flags); 647 + bit_spin_unlock(SL_locked, &slab->flags); 660 648 } 661 649 662 650 static inline bool ··· 1022 1010 { 1023 1011 pr_err("Slab 0x%p objects=%u used=%u fp=0x%p flags=%pGp\n", 1024 1012 slab, slab->objects, slab->inuse, slab->freelist, 1025 - &slab->__page_flags); 1013 + &slab->flags); 1026 1014 } 1027 1015 1028 1016 void skip_orig_size_check(struct kmem_cache *s, const void *object)