From: Liam R. Howlett Date: Tue, 28 Oct 2025 16:24:18 +0000 (-0400) Subject: mm/hugetlb: Pass boolean to hugetlb_mfill_prepare() instead of flags X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1025d56bc8264f9089e8528d3127d27806df3ee0;p=users%2Fjedix%2Flinux-maple.git mm/hugetlb: Pass boolean to hugetlb_mfill_prepare() instead of flags uffd_flags_t is used all over the place to communicate if the operation is requesting write protection. Just pass a boolean stating true for write protection or false for not. Signed-off-by: Liam R. Howlett --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index fee92ecd274d..55c0beb9107a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6939,7 +6939,7 @@ out_mutex: static inline ssize_t hugetlb_mfill_prepare(struct vm_area_struct *dst_vma, unsigned long dst_addr, - unsigned long increment, pte_t **dst_pte, u32 *hash, uffd_flags_t flags) + unsigned long increment, pte_t **dst_pte, u32 *hash, bool wp) { struct mm_struct *dst_mm = dst_vma->vm_mm; struct address_space *mapping; @@ -6963,7 +6963,7 @@ ssize_t hugetlb_mfill_prepare(struct vm_area_struct *dst_vma, unsigned long dst_ return -ENOMEM; } - if (!uffd_flags_mode_is(flags, MFILL_ATOMIC_CONTINUE) && + if (!wp && !huge_pte_none_mostly(huge_ptep_get(dst_mm, dst_addr, *dst_pte))) { hugetlb_vma_unlock_read(dst_vma); mutex_unlock(&hugetlb_fault_mutex_table[*hash]); @@ -7077,7 +7077,7 @@ static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma, u32 hash; ret = hugetlb_mfill_prepare(dst_vma, dst_addr, increment, - &dst_pte, &hash, flags); + &dst_pte, &hash, flags & MFILL_ATOMIC_WP); if (ret) return ret; @@ -7179,7 +7179,7 @@ static int hugetlb_mfill_atomic_pte_copy(struct vm_area_struct *dst_vma, u32 hash; ret = hugetlb_mfill_prepare(dst_vma, dst_addr, increment, - &dst_pte, &hash, flags); + &dst_pte, &hash, wp_enabled); if (ret) return ret;