The patch titled improve ZERO_PAGE handling in follow_page() has been removed from the -mm tree. Its filename was improve-zero_page-handling-in-follow_page.patch This patch was dropped because compilation failed. Please redo and resend The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: improve ZERO_PAGE handling in follow_page() From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> follow_page() is called from get_user_pages(), which returns specified user page. follow_page() can return 1) a page or 2) NULL or 3)ZERO_PAGE. If NULL, handle_mm_fault() is called. Now, follow_page() to unused pte returns NULL if page table exists. As a result get_user_pages() calls handle_mm_fault() and allocate new memory. This behavior increases memory consumption at coredump, which does read-once-but-never-written page fault. By returning ZERO_PAGE() against READ/ANON request, we can avoid it. (Because exec's arguments copy needs to call handle_mm_fault at WRITE/ANON request, we just handle READ/ANON case here.) Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Tested-by: Tony Battersby <tonyb@xxxxxxxxxxxxxxx> Acked-by: Nick Piggin <npiggin@xxxxxxx> Cc: Hugh Dickins <hugh@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff -puN mm/memory.c~improve-zero_page-handling-in-follow_page mm/memory.c --- a/mm/memory.c~improve-zero_page-handling-in-follow_page +++ a/mm/memory.c @@ -992,15 +992,15 @@ struct page *follow_page(struct vm_area_ page = NULL; pgd = pgd_offset(mm, address); if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) - goto no_page_table; + goto null_or_zeropage; pud = pud_offset(pgd, address); if (pud_none(*pud) || unlikely(pud_bad(*pud))) - goto no_page_table; + goto null_or_zeropage; pmd = pmd_offset(pud, address); if (pmd_none(*pmd)) - goto no_page_table; + goto null_or_zeropage; if (pmd_huge(*pmd)) { BUG_ON(flags & FOLL_GET); @@ -1016,8 +1016,14 @@ struct page *follow_page(struct vm_area_ goto out; pte = *ptep; - if (!pte_present(pte)) + if (!pte_present(pte)) { + /* Read fault to empty pte can return ZERO_PAGE */ + if (!(flags & FOLL_WRITE) && pte_none(pte)) { + pte_unmap_unlock(ptep, ptl); + goto null_or_zeropage; + } goto unlock; + } if ((flags & FOLL_WRITE) && !pte_write(pte)) goto unlock; page = vm_normal_page(vma, address, pte); @@ -1037,7 +1043,7 @@ unlock: out: return page; -no_page_table: +null_or_zeropage: /* * When core dumping an enormous anonymous area that nobody * has touched so far, we don't want to allocate page tables. _ Patches currently in -mm which might be from kamezawa.hiroyu@xxxxxxxxxxxxxx are memcg-fix-possible-panic-when-config_mm_owner=y.patch memcg-fix-possible-panic-when-config_mm_owner=y-checkpatch-fixes.patch cgroups-fix-documentation.patch improve-zero_page-handling-in-follow_page.patch mark-res_counter_charge_locked-with-__must_check.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