Skip to content

Commit

Permalink
mm, thp: do not queue fully unmapped pages for deferred split
Browse files Browse the repository at this point in the history
Adding fully unmapped pages into deferred split queue is not productive:
these pages are about to be freed or they are pinned and cannot be split
anyway.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Kirill A. Shutemov <[email protected]>
Reviewed-by: Yang Shi <[email protected]>
Cc: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kiryl authored and torvalds committed Dec 1, 2019
1 parent 74d4a57 commit f1fe80d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,23 +1292,29 @@ static void page_remove_anon_compound_rmap(struct page *page)
if (TestClearPageDoubleMap(page)) {
/*
* Subpages can be mapped with PTEs too. Check how many of
* themi are still mapped.
* them are still mapped.
*/
for (i = 0, nr = 0; i < HPAGE_PMD_NR; i++) {
if (atomic_add_negative(-1, &page[i]._mapcount))
nr++;
}

/*
* Queue the page for deferred split if at least one small
* page of the compound page is unmapped, but at least one
* small page is still mapped.
*/
if (nr && nr < HPAGE_PMD_NR)
deferred_split_huge_page(page);
} else {
nr = HPAGE_PMD_NR;
}

if (unlikely(PageMlocked(page)))
clear_page_mlock(page);

if (nr) {
if (nr)
__mod_node_page_state(page_pgdat(page), NR_ANON_MAPPED, -nr);
deferred_split_huge_page(page);
}
}

/**
Expand Down

0 comments on commit f1fe80d

Please sign in to comment.