]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: place __private in correct place, const-ify __mm_flags_get_word
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Wed, 13 Aug 2025 19:40:10 +0000 (20:40 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:24:51 +0000 (17:24 -0700)
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

index 46d3fb8935c70ffe515f762db4b2b0e976adea99..0e001dbad4559d6424b50612c73e33c40591ab70 100644 (file)
@@ -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;