Hi Andrew, Apologies, it turns out I put the __private sparse decorator in the wrong place :)
I enclose a fix-patch that fixes this (now *ahem* tested with sparse...) as well as fixing some trivial whitespace/code reuse/const stuff in a couple accessors. Cheers, Lorenzo ----8<---- >From cbe60f2c5e35bf1fcffb00c51f79f700edc17e06 Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes <lorenzo.stoa...@oracle.com> Date: Wed, 13 Aug 2025 20:40:10 +0100 Subject: [PATCH] mm: place __private in correct place, const-ify __mm_flags_get_word The __private sparse indicator was placed in the wrong location, resulting in sparse errors, correct this by placing it where it ought to be. Also, share some code for __mm_flags_get_word() and const-ify it to be consistent. Finally, fixup inconsistency in __mm_flags_set_word() param alignment. Signed-off-by: Lorenzo Stoakes <lorenzo.stoa...@oracle.com> --- include/linux/mm_types.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 46d3fb8935c7..0e001dbad455 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -934,8 +934,8 @@ struct mm_cid { */ #define NUM_MM_FLAG_BITS BITS_PER_LONG typedef struct { - __private DECLARE_BITMAP(__mm_flags, NUM_MM_FLAG_BITS); -} mm_flags_t; + DECLARE_BITMAP(__mm_flags, NUM_MM_FLAG_BITS); +} __private mm_flags_t; struct kioctx_table; struct iommu_mm_data; @@ -1233,17 +1233,8 @@ struct mm_struct { unsigned long cpu_bitmap[]; }; -/* Read the first system word of mm flags, non-atomically. */ -static inline unsigned long __mm_flags_get_word(struct mm_struct *mm) -{ - unsigned long *bitmap = ACCESS_PRIVATE(&mm->_flags, __mm_flags); - - return bitmap_read(bitmap, 0, BITS_PER_LONG); -} - /* Set the first system word of mm flags, non-atomically. */ -static inline void __mm_flags_set_word(struct mm_struct *mm, - unsigned long value) +static inline void __mm_flags_set_word(struct mm_struct *mm, unsigned long value) { unsigned long *bitmap = ACCESS_PRIVATE(&mm->_flags, __mm_flags); @@ -1256,6 +1247,14 @@ static inline const unsigned long *__mm_flags_get_bitmap(const struct mm_struct return (const unsigned long *)ACCESS_PRIVATE(&mm->_flags, __mm_flags); } +/* Read the first system word of mm flags, non-atomically. */ +static inline unsigned long __mm_flags_get_word(const struct mm_struct *mm) +{ + const unsigned long *bitmap = __mm_flags_get_bitmap(mm); + + return bitmap_read(bitmap, 0, BITS_PER_LONG); +} + #define MM_MT_FLAGS (MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN | \ MT_FLAGS_USE_RCU) extern struct mm_struct init_mm; -- 2.50.1