diff options
author | Wei Yang <richardw.yang@linux.intel.com> | 2019-12-01 02:57:49 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-12-01 21:59:09 +0100 |
commit | 4fb07ee6510280219403592e0a70c3b248b588c8 (patch) | |
tree | 57d45d34e514c0118c3241afdb6ceb4668b74287 /mm/userfaultfd.c | |
parent | mm/madvise.c: use PAGE_ALIGN[ED] for range checking (diff) | |
download | linux-4fb07ee6510280219403592e0a70c3b248b588c8.tar.xz linux-4fb07ee6510280219403592e0a70c3b248b588c8.zip |
userfaultfd: use vma_pagesize for all huge page size calculation
In __mcopy_atomic_hugetlb() we use two variables to deal with huge page
size: vma_hpagesize and huge_page_size.
Since they are the same, it is not necessary to use two different
mechanism. This patch makes it consistent by all using vma_hpagesize.
Link: http://lkml.kernel.org/r/20190927070032.2129-1-richardw.yang@linux.intel.com
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r-- | mm/userfaultfd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 6d152741bb26..c545ee84331d 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -259,7 +259,7 @@ retry: pte_t dst_pteval; BUG_ON(dst_addr >= dst_start + len); - VM_BUG_ON(dst_addr & ~huge_page_mask(h)); + VM_BUG_ON(dst_addr & (vma_hpagesize - 1)); /* * Serialize via hugetlb_fault_mutex @@ -270,7 +270,7 @@ retry: mutex_lock(&hugetlb_fault_mutex_table[hash]); err = -ENOMEM; - dst_pte = huge_pte_alloc(dst_mm, dst_addr, huge_page_size(h)); + dst_pte = huge_pte_alloc(dst_mm, dst_addr, vma_hpagesize); if (!dst_pte) { mutex_unlock(&hugetlb_fault_mutex_table[hash]); goto out_unlock; @@ -297,7 +297,8 @@ retry: err = copy_huge_page_from_user(page, (const void __user *)src_addr, - pages_per_huge_page(h), true); + vma_hpagesize / PAGE_SIZE, + true); if (unlikely(err)) { err = -EFAULT; goto out; |