The patch titled Subject: thp: copy_huge_pmd(): copy huge zero page has been added to the -mm tree. Its filename is thp-copy_huge_pmd-copy-huge-zero-page.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Subject: thp: copy_huge_pmd(): copy huge zero page 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 <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx> Cc: "H. Peter Anvin" <hpa@xxxxxxxxxxxxxxx> Cc: Mel Gorman <mel@xxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/huge_memory.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff -puN mm/huge_memory.c~thp-copy_huge_pmd-copy-huge-zero-page mm/huge_memory.c --- a/mm/huge_memory.c~thp-copy_huge_pmd-copy-huge-zero-page +++ a/mm/huge_memory.c @@ -709,6 +709,18 @@ static inline struct page *alloc_hugepag } #endif +static void set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm, + struct vm_area_struct *vma, unsigned long haddr, pmd_t *pmd) +{ + pmd_t entry; + entry = pfn_pmd(huge_zero_pfn, vma->vm_page_prot); + entry = pmd_wrprotect(entry); + entry = pmd_mkhuge(entry); + set_pmd_at(mm, haddr, pmd, entry); + pgtable_trans_huge_deposit(mm, pgtable); + mm->nr_ptes++; +} + int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, unsigned int flags) @@ -933,6 +945,11 @@ int copy_huge_pmd(struct mm_struct *dst_ pte_free(dst_mm, pgtable); goto out_unlock; } + if (is_huge_zero_pmd(pmd)) { + set_huge_zero_page(pgtable, dst_mm, vma, addr, dst_pmd); + ret = 0; + goto out_unlock; + } if (unlikely(pmd_trans_splitting(pmd))) { /* split huge page running from under us */ spin_unlock(&src_mm->page_table_lock); _ Patches currently in -mm which might be from kirill.shutemov@xxxxxxxxxxxxxxx are linux-next.patch mm-use-is_enabledconfig_numa-instead-of-numa_build.patch mm-use-is_enabledconfig_compaction-instead-of-compaction_build.patch thp-huge-zero-page-basic-preparation.patch thp-zap_huge_pmd-zap-huge-zero-pmd.patch thp-copy_huge_pmd-copy-huge-zero-page.patch thp-do_huge_pmd_wp_page-handle-huge-zero-page.patch thp-change_huge_pmd-keep-huge-zero-page-write-protected.patch thp-change-split_huge_page_pmd-interface.patch thp-implement-splitting-pmd-for-huge-zero-page.patch thp-setup-huge-zero-page-on-non-write-page-fault.patch thp-lazy-huge-zero-page-allocation.patch thp-implement-refcounting-for-huge-zero-page.patch thp-vmstat-implement-hzp_alloc-and-hzp_alloc_failed-events.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html