From: Liam R. Howlett Date: Tue, 28 Oct 2025 16:28:03 +0000 (-0400) Subject: mm/userfaultfd: Stop passing flags to mfill_atomic_install_pte() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=036de1b6a455b82a41802cdcdbcdd5ab34133877;p=users%2Fjedix%2Flinux-maple.git mm/userfaultfd: Stop passing flags to mfill_atomic_install_pte() Flags are being used to communicate if write protection is necessary. Just use a boolean. Signed-off-by: Liam R. Howlett --- diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h index fb26b5dc357b..83bb7a5397da 100644 --- a/include/linux/userfaultfd_k.h +++ b/include/linux/userfaultfd_k.h @@ -135,10 +135,9 @@ static inline uffd_flags_t uffd_flags_set_mode(uffd_flags_t flags, enum mfill_at /* Flags controlling behavior. These behavior changes are mode-independent. */ #define MFILL_ATOMIC_WP MFILL_ATOMIC_FLAG(0) -extern int mfill_atomic_install_pte(pmd_t *dst_pmd, - struct vm_area_struct *dst_vma, - unsigned long dst_addr, struct page *page, - bool newly_allocated, uffd_flags_t flags); +int mfill_atomic_install_pte(pmd_t *dst_pmd, struct vm_area_struct *dst_vma, + unsigned long dst_addr, struct page *page, + bool newly_allocated, bool wp); extern ssize_t mfill_atomic_copy(struct userfaultfd_ctx *ctx, unsigned long dst_start, unsigned long src_start, unsigned long len, diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index a7ed8224a9e1..3a7ada828817 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -168,7 +168,7 @@ static bool mfill_file_over_size(struct vm_area_struct *dst_vma, int mfill_atomic_install_pte(pmd_t *dst_pmd, struct vm_area_struct *dst_vma, unsigned long dst_addr, struct page *page, - bool newly_allocated, uffd_flags_t flags) + bool newly_allocated, bool wp) { int ret; struct mm_struct *dst_mm = dst_vma->vm_mm; @@ -185,7 +185,7 @@ int mfill_atomic_install_pte(pmd_t *dst_pmd, writable = false; if (writable) _dst_pte = pte_mkwrite(_dst_pte, dst_vma); - if (flags & MFILL_ATOMIC_WP) + if (wp) _dst_pte = pte_mkuffd_wp(_dst_pte); ret = -EAGAIN; @@ -312,7 +312,7 @@ int mfill_atomic_pte_copy(struct vm_area_struct *dst_vma, goto out_release; ret = mfill_atomic_install_pte(dst_pmd, dst_vma, dst_addr, - &folio->page, true, flags); + &folio->page, true, flags & MFILL_ATOMIC_WP); if (ret) goto out_release; out: @@ -344,7 +344,7 @@ static int mfill_atomic_pte_zeroed_folio(pmd_t *dst_pmd, __folio_mark_uptodate(folio); ret = mfill_atomic_install_pte(dst_pmd, dst_vma, dst_addr, - &folio->page, true, 0); + &folio->page, true, false); if (ret) goto out_put; @@ -426,7 +426,7 @@ int mfill_atomic_pte_continue(struct vm_area_struct *dst_vma, } ret = mfill_atomic_install_pte(dst_pmd, dst_vma, dst_addr, - page, false, flags); + page, false, flags & MFILL_ATOMIC_WP); if (ret) goto out_release;