| From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> |
| Subject: mm: place __private in correct place, const-ify __mm_flags_get_word |
| Date: Wed, 13 Aug 2025 20:40:10 +0100 |
| |
| 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. |
| |
| Link: https://lkml.kernel.org/r/d4ba117d-6234-4069-b871-254d152d7d21@lucifer.local |
| Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| include/linux/mm_types.h | 23 +++++++++++------------ |
| 1 file changed, 11 insertions(+), 12 deletions(-) |
| |
| --- a/include/linux/mm_types.h~mm-add-bitmap-mm-flags-field-fix |
| +++ a/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_ |
| 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; |
| _ |