[v2,2/3] userfaultfd: remove unnecessary warn_on in __mcopy_atomic_hugetlb
diff mbox series

Message ID 20190927070032.2129-2-richardw.yang@linux.intel.com
State New
Headers show
Series
  • [v2,1/3] userfaultfd: use vma_pagesize for all huge page size calculation
Related show

Commit Message

Wei Yang Sept. 27, 2019, 7 a.m. UTC
These 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

This means these warning will never be triggered.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

---
v2:
  * remove another related warning as suggested by Mike Kravetz
---
 mm/userfaultfd.c | 5 -----
 1 file changed, 5 deletions(-)

Patch
diff mbox series

diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index 01ad48621bb7..df11743f2196 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.
 	 */
@@ -262,7 +258,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 & (vma_hpagesize - 1));
 
 		/*
 		 * Serialize via hugetlb_fault_mutex