]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: convert prctl to mm_flags_*() accessors
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Tue, 12 Aug 2025 15:44:12 +0000 (16:44 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:24:52 +0000 (17:24 -0700)
As part of the effort to move to mm->flags becoming a bitmap field,
convert existing users to making use of the mm_flags_*() accessors which
will, when the conversion is complete, be the only means of accessing
mm_struct flags.

No functional change intended.

Link: https://lkml.kernel.org/r/b64f07b94822d02beb88d0d21a6a85f9ee45fc69.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>
kernel/sys.c

index 1e28b40053ce206d7d0ed27e8a4fce8b616c3565..605f7fe9a143214910f4770a43f1d46cd93ec980 100644 (file)
@@ -2392,9 +2392,9 @@ static inline unsigned long get_current_mdwe(void)
 {
        unsigned long ret = 0;
 
-       if (test_bit(MMF_HAS_MDWE, &current->mm->flags))
+       if (mm_flags_test(MMF_HAS_MDWE, current->mm))
                ret |= PR_MDWE_REFUSE_EXEC_GAIN;
-       if (test_bit(MMF_HAS_MDWE_NO_INHERIT, &current->mm->flags))
+       if (mm_flags_test(MMF_HAS_MDWE_NO_INHERIT, current->mm))
                ret |= PR_MDWE_NO_INHERIT;
 
        return ret;
@@ -2427,9 +2427,9 @@ static inline int prctl_set_mdwe(unsigned long bits, unsigned long arg3,
                return -EPERM; /* Cannot unset the flags */
 
        if (bits & PR_MDWE_NO_INHERIT)
-               set_bit(MMF_HAS_MDWE_NO_INHERIT, &current->mm->flags);
+               mm_flags_set(MMF_HAS_MDWE_NO_INHERIT, current->mm);
        if (bits & PR_MDWE_REFUSE_EXEC_GAIN)
-               set_bit(MMF_HAS_MDWE, &current->mm->flags);
+               mm_flags_set(MMF_HAS_MDWE, current->mm);
 
        return 0;
 }
@@ -2627,7 +2627,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
        case PR_GET_THP_DISABLE:
                if (arg2 || arg3 || arg4 || arg5)
                        return -EINVAL;
-               error = !!test_bit(MMF_DISABLE_THP, &me->mm->flags);
+               error = !!mm_flags_test(MMF_DISABLE_THP, me->mm);
                break;
        case PR_SET_THP_DISABLE:
                if (arg3 || arg4 || arg5)
@@ -2635,9 +2635,9 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
                if (mmap_write_lock_killable(me->mm))
                        return -EINTR;
                if (arg2)
-                       set_bit(MMF_DISABLE_THP, &me->mm->flags);
+                       mm_flags_set(MMF_DISABLE_THP, me->mm);
                else
-                       clear_bit(MMF_DISABLE_THP, &me->mm->flags);
+                       mm_flags_clear(MMF_DISABLE_THP, me->mm);
                mmap_write_unlock(me->mm);
                break;
        case PR_MPX_ENABLE_MANAGEMENT:
@@ -2770,7 +2770,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
                if (arg2 || arg3 || arg4 || arg5)
                        return -EINVAL;
 
-               error = !!test_bit(MMF_VM_MERGE_ANY, &me->mm->flags);
+               error = !!mm_flags_test(MMF_VM_MERGE_ANY, me->mm);
                break;
 #endif
        case PR_RISCV_V_SET_CONTROL: