Re: [PATCH 1/2] userfaultfd: remove one unnecessary warn_on in __mcopy_atomic_hugetlb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/25/19 5:18 AM, Wei Yang wrote:
> The warning here is to make sure address(dst_addr) and length(len -
> copied) are huge page size aligned.
> 
> While this is ensured by:
> 
>     dst_start and len is huge page size aligned
>     dst_addr equals to dst_start and increase huge page size each time
>     copied increase huge page size each time

Can we also remove the following for the same reasons?

diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index 640ff2bd9a69..f82d5ec698d8 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -262,7 +262,6 @@ static __always_inline ssize_t __mcopy_atomic_hugetlb(struct mm_struct *dst_mm,
 		pte_t dst_pteval;
 
 		BUG_ON(dst_addr >= dst_start + len);
-		VM_BUG_ON(dst_addr & ~huge_page_mask(h));
 
 		/*
 		 * Serialize via hugetlb_fault_mutex

-- 
Mike Kravetz

> 
> This means this warning will never be triggered.
> 
> Signed-off-by: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx>
> ---
>  mm/userfaultfd.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
> index c7ae74ce5ff3..7895c715000e 100644
> --- a/mm/userfaultfd.c
> +++ b/mm/userfaultfd.c
> @@ -243,10 +243,6 @@ static __always_inline ssize_t __mcopy_atomic_hugetlb(struct mm_struct *dst_mm,
>  		vm_shared = dst_vma->vm_flags & VM_SHARED;
>  	}
>  
> -	if (WARN_ON(dst_addr & (vma_hpagesize - 1) ||
> -		    (len - copied) & (vma_hpagesize - 1)))
> -		goto out_unlock;
> -
>  	/*
>  	 * If not shared, ensure the dst_vma has a anon_vma.
>  	 */
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux