The patch titled Subject: mm: thp: clear PageDoubleMap flag when the last PMD map gone has been removed from the -mm tree. Its filename was mm-thp-clear-pagedoublemap-flag-when-the-last-pmd-map-gone.patch This patch was dropped because it was nacked ------------------------------------------------------ From: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Subject: mm: thp: clear PageDoubleMap flag when the last PMD map gone File THP sets PageDoubleMap flag when the first it gets PTE mapped, but the flag is never cleared until the THP is freed. This result in unbalanced state although it is not a big deal. Clear the flag when the last compound_mapcount is gone. It should be cleared when all the PTE maps are gone (become PMD mapped only) as well, but this needs check all subpage's _mapcount every time any subpage's rmap is removed, the overhead may be not worth. The anonymous THP also just clears PageDoubleMap flag when the last PMD map is gone. Link: http://lkml.kernel.org/r/1571938066-29031-1-git-send-email-yang.shi@xxxxxxxxxxxxxxxxx Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Acked-by: Song Liu <songliubraving@xxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/rmap.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/rmap.c~mm-thp-clear-pagedoublemap-flag-when-the-last-pmd-map-gone +++ a/mm/rmap.c @@ -1256,6 +1256,9 @@ static void page_remove_file_rmap(struct __dec_node_page_state(page, NR_SHMEM_PMDMAPPED); else __dec_node_page_state(page, NR_FILE_PMDMAPPED); + + /* The last PMD map is gone */ + ClearPageDoubleMap(compound_head(page)); } else { if (!atomic_add_negative(-1, &page->_mapcount)) goto out; _ Patches currently in -mm which might be from yang.shi@xxxxxxxxxxxxxxxxx are mm-thp-handle-page-cache-thp-correctly-in-pagetranscompoundmap.patch mm-thp-handle-page-cache-thp-correctly-in-pagetranscompoundmap-v4.patch mm-vmscan-remove-unused-scan_control-parameter-from-pageout.patch