[PATCH v3 6/7] mm: use BIT() for change_protection() flags
From: Gregory Price
Date: Tue Sep 22 2026 - 14:38:23 EST
From: "Gregory Price (Meta)" <gourry@xxxxxxxxxx>
The MM_CP_* flags are individual bits expressed as open-coded shifts.
Use BIT() consistently for the complete block.
No functional change intended.
Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
Link: https://lore.kernel.org/r/9b5e1573-6fd8-48a5-a274-a6e7ff83d2fe@xxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
---
include/linux/mm.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 225ba26c9d503..c2ffba42019c0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3596,21 +3596,21 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen);
* because something (e.g., COW, uffd-wp) blocks that from happening for all
* PTEs automatically in a writable mapping.
*/
-#define MM_CP_TRY_CHANGE_WRITABLE (1UL << 0)
+#define MM_CP_TRY_CHANGE_WRITABLE BIT(0)
/* Whether this protection change is for NUMA hints */
-#define MM_CP_PROT_NUMA (1UL << 1)
+#define MM_CP_PROT_NUMA BIT(1)
/* Whether this change is for write protecting */
-#define MM_CP_UFFD_WP (1UL << 2) /* do wp */
-#define MM_CP_UFFD_WP_RESOLVE (1UL << 3) /* Resolve wp */
+#define MM_CP_UFFD_WP BIT(2) /* do wp */
+#define MM_CP_UFFD_WP_RESOLVE BIT(3) /* Resolve wp */
#define MM_CP_UFFD_WP_ALL (MM_CP_UFFD_WP | \
MM_CP_UFFD_WP_RESOLVE)
/* Whether this change is for uffd RWP */
-#define MM_CP_UFFD_RWP (1UL << 4) /* do rwp */
-#define MM_CP_UFFD_RWP_RESOLVE (1UL << 5) /* resolve rwp */
+#define MM_CP_UFFD_RWP BIT(4) /* do rwp */
+#define MM_CP_UFFD_RWP_RESOLVE BIT(5) /* resolve rwp */
#define MM_CP_UFFD_RWP_ALL (MM_CP_UFFD_RWP | \
MM_CP_UFFD_RWP_RESOLVE)
/* Whether a MM_CP_PROT_NUMA change is for promotion only */
-#define MM_CP_PROT_NUMA_PROMO_ONLY (1UL << 6)
+#define MM_CP_PROT_NUMA_PROMO_ONLY BIT(6)
bool can_change_pte_writable(struct vm_area_struct *vma, unsigned long addr,
pte_t pte);
--
2.53.0-Meta