The patch titled Subject: mm: clean up lazyfree page handling has been added to the -mm tree. Its filename is mm-reclaim-madv_free-pages-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-reclaim-madv_free-pages-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-reclaim-madv_free-pages-fix.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: Minchan Kim <minchan@xxxxxxxxxx> Subject: mm: clean up lazyfree page handling We can make it simple to understand without need to be aware of clean-swapin page. This patch just clean up lazyfree page handling in try_to_unmap_one. Link: http://lkml.kernel.org/r/20170303025237.GB3503@bbox Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx> Cc: Shaohua Li <shli@xxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Hillf Danton <hillf.zj@xxxxxxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/rmap.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff -puN mm/rmap.c~mm-reclaim-madv_free-pages-fix mm/rmap.c --- a/mm/rmap.c~mm-reclaim-madv_free-pages-fix +++ a/mm/rmap.c @@ -1415,17 +1415,17 @@ static int try_to_unmap_one(struct page VM_BUG_ON_PAGE(!PageSwapCache(page) && PageSwapBacked(page), page); - /* - * swapin page could be clean, it has data stored in - * swap. We can't silently discard it without setting - * swap entry in the page table. - */ - if (!PageDirty(page) && !PageSwapCache(page)) { - /* It's a freeable page by MADV_FREE */ - dec_mm_counter(mm, MM_ANONPAGES); - goto discard; - } else if (!PageSwapBacked(page)) { - /* dirty MADV_FREE page */ + /* MADV_FREE page check */ + if (!PageSwapBacked(page)) { + if (!PageDirty(page)) { + dec_mm_counter(mm, MM_ANONPAGES); + goto discard; + } + + /* + * If the page was redirtied, it cannot be + * discarded. Remap the page to page table. + */ set_pte_at(mm, address, pvmw.pte, pteval); ret = SWAP_DIRTY; page_vma_mapped_walk_done(&pvmw); _ Patches currently in -mm which might be from minchan@xxxxxxxxxx are mm-reclaim-madv_free-pages-fix.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