summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>2025-08-12 18:44:19 +0300
committerAndrew Morton <akpm@linux-foundation.org>2025-09-14 02:54:58 +0300
commit8166353fb8841390bf3ffe1b923a5ddeb348e4f7 (patch)
tree26ef9189cfee2446e86ca303c8dfb6b7def8ec90 /include
parentd14d3f535e13ff0661b9a74133a8d6b9f9950712 (diff)
downloadlinux-8166353fb8841390bf3ffe1b923a5ddeb348e4f7.tar.xz
mm: replace mm->flags with bitmap entirely and set to 64 bits
Now we have updated all users of mm->flags to use the bitmap accessors, repalce it with the bitmap version entirely. We are then able to move to having 64 bits of mm->flags on both 32-bit and 64-bit architectures. We also update the VMA userland tests to ensure that everything remains functional there. No functional changes intended, other than there now being 64 bits of available mm_struct flags. Link: https://lkml.kernel.org/r/e1f6654e016d36c43959764b01355736c5cbcdf8.1755012943.git.lorenzo.stoakes@oracle.com Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: David Hildenbrand <david@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Barry Song <baohua@kernel.org> Cc: Ben Segall <bsegall@google.com> Cc: Borislav Betkov <bp@alien8.de> Cc: Chengming Zhou <chengming.zhou@linux.dev> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: Christian Brauner <brauner@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: David S. Miller <davem@davemloft.net> Cc: Dev Jain <dev.jain@arm.com> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jan Kara <jack@suse.cz> Cc: Jann Horn <jannh@google.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Kees Cook <kees@kernel.org> Cc: Marc Rutland <mark.rutland@arm.com> Cc: Mariano Pache <npache@redhat.com> Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> Cc: Mateusz Guzik <mjguzik@gmail.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Mel Gorman <mgorman <mgorman@suse.de> Cc: Michal Hocko <mhocko@suse.com> Cc: Namhyung kim <namhyung@kernel.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Xu <peterx@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Thomas Gleinxer <tglx@linutronix.de> Cc: Valentin Schneider <vschneid@redhat.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: xu xin <xu.xin16@zte.com.cn> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h12
-rw-r--r--include/linux/mm_types.h14
2 files changed, 11 insertions, 15 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 34311ebe62cc..b61e2d4858cf 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -724,32 +724,32 @@ static inline void assert_fault_locked(struct vm_fault *vmf)
static inline bool mm_flags_test(int flag, const struct mm_struct *mm)
{
- return test_bit(flag, ACCESS_PRIVATE(&mm->_flags, __mm_flags));
+ return test_bit(flag, ACCESS_PRIVATE(&mm->flags, __mm_flags));
}
static inline bool mm_flags_test_and_set(int flag, struct mm_struct *mm)
{
- return test_and_set_bit(flag, ACCESS_PRIVATE(&mm->_flags, __mm_flags));
+ return test_and_set_bit(flag, ACCESS_PRIVATE(&mm->flags, __mm_flags));
}
static inline bool mm_flags_test_and_clear(int flag, struct mm_struct *mm)
{
- return test_and_clear_bit(flag, ACCESS_PRIVATE(&mm->_flags, __mm_flags));
+ return test_and_clear_bit(flag, ACCESS_PRIVATE(&mm->flags, __mm_flags));
}
static inline void mm_flags_set(int flag, struct mm_struct *mm)
{
- set_bit(flag, ACCESS_PRIVATE(&mm->_flags, __mm_flags));
+ set_bit(flag, ACCESS_PRIVATE(&mm->flags, __mm_flags));
}
static inline void mm_flags_clear(int flag, struct mm_struct *mm)
{
- clear_bit(flag, ACCESS_PRIVATE(&mm->_flags, __mm_flags));
+ clear_bit(flag, ACCESS_PRIVATE(&mm->flags, __mm_flags));
}
static inline void mm_flags_clear_all(struct mm_struct *mm)
{
- bitmap_zero(ACCESS_PRIVATE(&mm->_flags, __mm_flags), NUM_MM_FLAG_BITS);
+ bitmap_zero(ACCESS_PRIVATE(&mm->flags, __mm_flags), NUM_MM_FLAG_BITS);
}
extern const struct vm_operations_struct vma_dummy_vm_ops;
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 69ce407b4343..05475b5fd516 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -932,7 +932,7 @@ struct mm_cid {
* Opaque type representing current mm_struct flag state. Must be accessed via
* mm_flags_xxx() helper functions.
*/
-#define NUM_MM_FLAG_BITS BITS_PER_LONG
+#define NUM_MM_FLAG_BITS (64)
typedef struct {
DECLARE_BITMAP(__mm_flags, NUM_MM_FLAG_BITS);
} __private mm_flags_t;
@@ -1119,11 +1119,7 @@ struct mm_struct {
/* Architecture-specific MM context */
mm_context_t context;
- /* Temporary union while we convert users to mm_flags_t. */
- union {
- unsigned long flags; /* Must use atomic bitops to access */
- mm_flags_t _flags; /* Must use mm_flags_* helpers to access */
- };
+ mm_flags_t flags; /* Must use mm_flags_* hlpers to access */
#ifdef CONFIG_AIO
spinlock_t ioctx_lock;
@@ -1236,7 +1232,7 @@ struct mm_struct {
/* Set the first system word of mm flags, non-atomically. */
static inline void __mm_flags_set_word(struct mm_struct *mm, unsigned long value)
{
- unsigned long *bitmap = ACCESS_PRIVATE(&mm->_flags, __mm_flags);
+ unsigned long *bitmap = ACCESS_PRIVATE(&mm->flags, __mm_flags);
bitmap_copy(bitmap, &value, BITS_PER_LONG);
}
@@ -1244,7 +1240,7 @@ static inline void __mm_flags_set_word(struct mm_struct *mm, unsigned long value
/* Obtain a read-only view of the bitmap. */
static inline const unsigned long *__mm_flags_get_bitmap(const struct mm_struct *mm)
{
- return (const unsigned long *)ACCESS_PRIVATE(&mm->_flags, __mm_flags);
+ return (const unsigned long *)ACCESS_PRIVATE(&mm->flags, __mm_flags);
}
/* Read the first system word of mm flags, non-atomically. */
@@ -1262,7 +1258,7 @@ static inline unsigned long __mm_flags_get_word(const struct mm_struct *mm)
static inline void __mm_flags_set_mask_bits_word(struct mm_struct *mm,
unsigned long mask, unsigned long bits)
{
- unsigned long *bitmap = ACCESS_PRIVATE(&mm->_flags, __mm_flags);
+ unsigned long *bitmap = ACCESS_PRIVATE(&mm->flags, __mm_flags);
set_mask_bits(bitmap, mask, bits);
}