I didn't test this patch but just wanted to make lagefree pages KSM. Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx> --- mm/ksm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 68710e80994a..43ca73aa45e7 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -470,7 +470,8 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item) page = follow_page(vma, addr, FOLL_GET); if (IS_ERR_OR_NULL(page)) goto out; - if (PageAnon(page) || page_trans_compound_anon(page)) { + if ((PageAnon(page) && !PageLazyFree(page)) || + page_trans_compound_anon(page)) { flush_anon_page(vma, page, addr); flush_dcache_page(page); } else { @@ -1032,13 +1033,20 @@ static int try_to_merge_one_page(struct vm_area_struct *vma, /* * We need the page lock to read a stable PageSwapCache in - * write_protect_page(). We use trylock_page() instead of - * lock_page() because we don't want to wait here - we - * prefer to continue scanning and merging different pages, + * write_protect_page() and check lazyfree. + * We use trylock_page() instead of lock_page() because we + * don't want to wait here - we prefer to continue scanning + * and merging different pages, * then come back to this page when it is unlocked. */ if (!trylock_page(page)) goto out; + + if (PageLazyFree(page)) { + unlock_page(page); + goto out; + } + /* * If this anonymous page is mapped only here, its pte may need * to be write-protected. If it's mapped elsewhere, all of its @@ -1621,7 +1629,7 @@ next_mm: cond_resched(); continue; } - if (PageAnon(*page) || + if ((PageAnon(*page) && !PageLazyFree(*page)) || page_trans_compound_anon(*page)) { flush_anon_page(vma, *page, ksm_scan.address); flush_dcache_page(*page); -- 1.9.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>