efi_mm is now marked as a kernel mm, like init_mm. mm_is_kernel()
therefore gives the right answer for efi_mm and mm_is_user() is now
equivalent to !mm_is_kernel().

Remove mm_is_user() and directly use mm_is_kernel() instead.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Kevin Brodsky <[email protected]>
---
 arch/arm64/mm/contpte.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c
index ad5c04cf66ff..e21e279101ca 100644
--- a/arch/arm64/mm/contpte.c
+++ b/arch/arm64/mm/contpte.c
@@ -4,23 +4,9 @@
  */
 
 #include <linux/mm.h>
-#include <linux/efi.h>
 #include <linux/export.h>
 #include <asm/tlbflush.h>
 
-static inline bool mm_is_user(struct mm_struct *mm)
-{
-       /*
-        * Don't attempt to apply the contig bit to kernel mappings, because
-        * dynamically adding/removing the contig bit can cause page faults.
-        * These racing faults are ok for user space, since they get serialized
-        * on the PTL. But kernel mappings can't tolerate faults.
-        */
-       if (unlikely(mm_is_efi(mm)))
-               return false;
-       return !mm_is_kernel(mm);
-}
-
 static inline pte_t *contpte_align_down(pte_t *ptep)
 {
        return PTR_ALIGN_DOWN(ptep, sizeof(*ptep) * CONT_PTES);
@@ -263,7 +249,13 @@ void __contpte_try_fold(struct mm_struct *mm, unsigned 
long addr,
 
        int i;
 
-       if (!mm_is_user(mm))
+       /*
+        * Don't attempt to apply the contig bit to kernel mappings, because
+        * dynamically adding/removing the contig bit can cause page faults.
+        * These racing faults are ok for user space, since they get serialized
+        * on the PTL. But kernel mappings can't tolerate faults.
+        */
+       if (mm_is_kernel(mm))
                return;
 
        page = pte_page(pte);
@@ -302,7 +294,7 @@ void __contpte_try_unfold(struct mm_struct *mm, unsigned 
long addr,
         * We have already checked that the ptes are contiguous in
         * contpte_try_unfold(), so just check that the mm is user space.
         */
-       if (!mm_is_user(mm))
+       if (mm_is_kernel(mm))
                return;
 
        pte = pte_mknoncont(pte);
@@ -465,7 +457,7 @@ void contpte_set_ptes(struct mm_struct *mm, unsigned long 
addr,
         */
        VM_WARN_ON(nr == 1);
 
-       if (!mm_is_user(mm))
+       if (mm_is_kernel(mm))
                return __set_ptes(mm, addr, ptep, pte, nr);
 
        end = addr + (nr << PAGE_SHIFT);

-- 
2.51.2


Reply via email to