From: Florent Revest <revest@chromium.org>
To: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, hpa@zytor.com, akpm@linux-foundation.org,
broonie@kernel.org, thiago.bauermann@linaro.org,
jackmanb@google.com, Florent Revest <revest@chromium.org>
Subject: [PATCH v2 3/4] mm: use VM_HIGH_ARCH_* macros consistently
Date: Wed, 7 May 2025 15:09:59 +0200 [thread overview]
Message-ID: <20250507131000.1204175-4-revest@chromium.org> (raw)
In-Reply-To: <20250507131000.1204175-1-revest@chromium.org>
Currently, some high vma flag bits are defined using VM_HIGH_ARCH_*
helper macros but others are not. Use the macros consistently so it's
easier to spot which ones are used/free.
To keep the VMA flags space easier to read and think about, VM_SEALED is
also shifted down from a very high bit (63rd) to a lower one (42nd).
Signed-off-by: Florent Revest <revest@chromium.org>
---
include/linux/mm.h | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index da8f99a026deb..b12549f0a6dce 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -305,6 +305,10 @@ extern unsigned int kobjsize(const void *objp);
#define VM_HIGH_ARCH_BIT_4 36 /* bit only usable on 64-bit architectures */
#define VM_HIGH_ARCH_BIT_5 37 /* bit only usable on 64-bit architectures */
#define VM_HIGH_ARCH_BIT_6 38 /* bit only usable on 64-bit architectures */
+#define VM_HIGH_ARCH_BIT_7 39 /* bit only usable on 64-bit architectures */
+#define VM_HIGH_ARCH_BIT_8 40 /* bit only usable on 64-bit architectures */
+#define VM_HIGH_ARCH_BIT_9 41 /* bit only usable on 64-bit architectures */
+#define VM_HIGH_ARCH_BIT_10 42 /* bit only usable on 64-bit architectures */
#define VM_HIGH_ARCH_0 BIT(VM_HIGH_ARCH_BIT_0)
#define VM_HIGH_ARCH_1 BIT(VM_HIGH_ARCH_BIT_1)
#define VM_HIGH_ARCH_2 BIT(VM_HIGH_ARCH_BIT_2)
@@ -312,6 +316,10 @@ extern unsigned int kobjsize(const void *objp);
#define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4)
#define VM_HIGH_ARCH_5 BIT(VM_HIGH_ARCH_BIT_5)
#define VM_HIGH_ARCH_6 BIT(VM_HIGH_ARCH_BIT_6)
+#define VM_HIGH_ARCH_7 BIT(VM_HIGH_ARCH_BIT_7)
+#define VM_HIGH_ARCH_8 BIT(VM_HIGH_ARCH_BIT_8)
+#define VM_HIGH_ARCH_9 BIT(VM_HIGH_ARCH_BIT_9)
+#define VM_HIGH_ARCH_10 BIT(VM_HIGH_ARCH_BIT_10)
#endif /* CONFIG_64BIT */
#ifdef CONFIG_ARCH_HAS_PKEYS
@@ -385,8 +393,7 @@ extern unsigned int kobjsize(const void *objp);
#endif
#ifdef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR
-# define VM_UFFD_MINOR_BIT 41
-# define VM_UFFD_MINOR BIT(VM_UFFD_MINOR_BIT) /* UFFD minor faults */
+# define VM_UFFD_MINOR VM_HIGH_ARCH_9 /* UFFD minor faults */
#else /* !CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */
# define VM_UFFD_MINOR VM_NONE
#endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */
@@ -399,15 +406,13 @@ extern unsigned int kobjsize(const void *objp);
* if KVM does not lock down the memory type.
*/
#ifdef CONFIG_64BIT
-#define VM_ALLOW_ANY_UNCACHED_BIT 39
-#define VM_ALLOW_ANY_UNCACHED BIT(VM_ALLOW_ANY_UNCACHED_BIT)
+#define VM_ALLOW_ANY_UNCACHED VM_HIGH_ARCH_7
#else
#define VM_ALLOW_ANY_UNCACHED VM_NONE
#endif
#ifdef CONFIG_64BIT
-#define VM_DROPPABLE_BIT 40
-#define VM_DROPPABLE BIT(VM_DROPPABLE_BIT)
+#define VM_DROPPABLE VM_HIGH_ARCH_8
#elif defined(CONFIG_PPC32)
#define VM_DROPPABLE VM_ARCH_1
#else
@@ -416,7 +421,7 @@ extern unsigned int kobjsize(const void *objp);
#ifdef CONFIG_64BIT
/* VM is sealed, in vm_flags */
-#define VM_SEALED _BITUL(63)
+#define VM_SEALED VM_HIGH_ARCH_10
#endif
/* Bits set in the VMA until the stack is in its final location */
--
2.49.0.987.g0cc8ee98dc-goog
next prev parent reply other threads:[~2025-05-07 13:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 13:09 [PATCH v2 0/4] mm: Avoid sharing high VMA flag bits Florent Revest
2025-05-07 13:09 ` [PATCH v2 1/4] mm: fix VM_UFFD_MINOR == VM_SHADOW_STACK on USERFAULTFD=y && ARM64_GCS=y Florent Revest
2025-05-07 13:09 ` [PATCH v2 2/4] mm: remove CONFIG_ARCH_USES_HIGH_VMA_FLAGS Florent Revest
2025-05-07 13:09 ` Florent Revest [this message]
2025-05-07 13:10 ` [PATCH v2 4/4] mm: consolidate VM_HIGH_ARCH_* macros into parametric macros Florent Revest
2025-05-07 22:51 ` [PATCH v2 0/4] mm: Avoid sharing high VMA flag bits Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250507131000.1204175-4-revest@chromium.org \
--to=revest@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jackmanb@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=thiago.bauermann@linaro.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox