Thread (49 messages) 49 messages, 9 authors, 2026-08-30

Re: [PATCH 1/6] mm/gup: move gup_can_follow_protnone() to gup.c

flat view

From: Mike Rapoport <rppt@kernel.org>
Date: 2026-08-25 10:10:18
Also in: linux-doc, linux-fsdevel, linux-mm, lkml

On Mon, Aug 24, 2026 at 04:42:56PM +0200, David Hildenbrand (Arm) wrote:
On 8/23/26 14:17, Mike Rapoport (Microsoft) wrote:
quoted
gup_can_follow_protnone() is defined in include/linux/mm.h but only used
by mm/gup.c.

First, there is no reason to have it in already gigantic header.
Once upon a time there was a user in mm/huge_memory.c, in a beautifully named
function called follow_trans_huge_pmd().
quoted
Next, the upcoming refactoring of userfaultfd flags will make
gup_can_follow_protnone() depend on userfaultfd_k.h which would cause a
cyclic header dependency.

Move gup_can_follow_protnone() to mm/gup.c.

No functional change.

Assisted-by: copilot:claude-opus-5
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---

[...]
quoted
 typedef int (*pte_fn_t)(pte_t *pte, unsigned long addr, void *data);
 extern int apply_to_page_range(struct mm_struct *mm, unsigned long address,
 			       unsigned long size, pte_fn_t fn, void *data);
diff --git a/mm/gup.c b/mm/gup.c
index eb898ea1ee22..500e2aa99e48 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -633,6 +633,44 @@ static struct page *no_page_table(struct vm_area_struct *vma,
 	return NULL;
 }
 
+/*
+ * Indicates whether GUP can follow a PROT_NONE mapped page, or whether
+ * a (NUMA hinting or userfaultfd RWP) fault is required.
+ */
+static inline bool gup_can_follow_protnone(const struct vm_area_struct *vma,
+					   unsigned int flags)
While at it, could switch to double-tab here.
Ok.
 
Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David
-- 
Sincerely yours,
Mike.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help