The patch titled Subject: mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin() has been added to the -mm tree. Its filename is mm-thp-fix-leaking-mapped-pte-in-__collapse_huge_page_swapin.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-thp-fix-leaking-mapped-pte-in-__collapse_huge_page_swapin.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-thp-fix-leaking-mapped-pte-in-__collapse_huge_page_swapin.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: Ebru Akagunduz <ebru.akagunduz@xxxxxxxxx> Subject: mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin() Currently, khugepaged does not permit swapin if there are enough young pages in a THP. The problem is when a THP does not have enough young pages, khugepaged leaks mapped ptes. This patch prohibits leaking mapped ptes. Link: http://lkml.kernel.org/r/1472820276-7831-1-git-send-email-ebru.akagunduz@xxxxxxxxx Signed-off-by: Ebru Akagunduz <ebru.akagunduz@xxxxxxxxx> Suggested-by: Andrea Arcangeli <aarcange@xxxxxxxxxx> Reviewed-by: Rik van Riel <riel@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff -puN mm/khugepaged.c~mm-thp-fix-leaking-mapped-pte-in-__collapse_huge_page_swapin mm/khugepaged.c --- a/mm/khugepaged.c~mm-thp-fix-leaking-mapped-pte-in-__collapse_huge_page_swapin +++ a/mm/khugepaged.c @@ -881,6 +881,11 @@ static bool __collapse_huge_page_swapin( .pmd = pmd, }; + /* we only decide to swapin, if there is enough young ptes */ + if (referenced < HPAGE_PMD_NR/2) { + trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); + return false; + } fe.pte = pte_offset_map(pmd, address); for (; fe.address < address + HPAGE_PMD_NR*PAGE_SIZE; fe.pte++, fe.address += PAGE_SIZE) { @@ -888,11 +893,6 @@ static bool __collapse_huge_page_swapin( if (!is_swap_pte(pteval)) continue; swapped_in++; - /* we only decide to swapin, if there is enough young ptes */ - if (referenced < HPAGE_PMD_NR/2) { - trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); - return false; - } ret = do_swap_page(&fe, pteval); /* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */ _ Patches currently in -mm which might be from ebru.akagunduz@xxxxxxxxx are mm-thp-fix-leaking-mapped-pte-in-__collapse_huge_page_swapin.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