Commit 0089e485 authored by Hillf Danton's avatar Hillf Danton Committed by Linus Torvalds

mm/huge_memory: fix copying user highpage

The THP copy-on-write handler falls back to regular-sized pages for a huge
page replacement upon allocation failure or if THP has been individually
disabled in the target VMA.  The loop responsible for copying page-sized
chunks accidentally uses multiples of PAGE_SHIFT instead of PAGE_SIZE as
the virtual address arg for copy_user_highpage().
Signed-off-by: default avatarHillf Danton <dhillf@gmail.com>
Acked-by: default avatarJohannes Weiner <jweiner@redhat.com>
Reviewed-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent df9d6985
...@@ -830,7 +830,7 @@ static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, ...@@ -830,7 +830,7 @@ static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm,
for (i = 0; i < HPAGE_PMD_NR; i++) { for (i = 0; i < HPAGE_PMD_NR; i++) {
copy_user_highpage(pages[i], page + i, copy_user_highpage(pages[i], page + i,
haddr + PAGE_SHIFT*i, vma); haddr + PAGE_SIZE * i, vma);
__SetPageUptodate(pages[i]); __SetPageUptodate(pages[i]);
cond_resched(); cond_resched();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment