From: Kirill A. Shutemov Date: Thu, 29 Nov 2012 03:17:35 +0000 (+1100) Subject: thp-copy_huge_pmd-copy-huge-zero-page-v6 X-Git-Tag: next-20121205~1^2~272 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=02d509cf44806e6974647725f8ce9dbbdc083d53;p=karo-tx-linux.git thp-copy_huge_pmd-copy-huge-zero-page-v6 It's easy to copy huge zero page. Just set destination pmd to huge zero page. It's safe to copy huge zero page since we have none yet :-p Signed-off-by: Kirill A. Shutemov Cc: Andrea Arcangeli Cc: Andi Kleen Cc: "H. Peter Anvin" Cc: Mel Gorman Cc: David Rientjes Signed-off-by: Andrew Morton --- diff --git a/mm/huge_memory.c b/mm/huge_memory.c index afe8b3d034e2..662ac5bea124 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -958,6 +958,11 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, pte_free(dst_mm, pgtable); goto out_unlock; } + /* + * mm->pagetable lock is enough to be sure that huge zero pmd is not + * under splitting since we don't split the page itself, only pmd to + * a page table. + */ if (is_huge_zero_pmd(pmd)) { set_huge_zero_page(pgtable, dst_mm, vma, addr, dst_pmd); ret = 0;