The patch titled Subject: mm/vmscan.c: support removing arbitrary sized pages from mapping has been added to the -mm tree. Its filename is mm-support-removing-arbitrary-sized-pages-from-mapping.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-support-removing-arbitrary-sized-pages-from-mapping.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-support-removing-arbitrary-sized-pages-from-mapping.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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: William Kucharski <william.kucharski@xxxxxxxxxx> Subject: mm/vmscan.c: support removing arbitrary sized pages from mapping __remove_mapping() assumes that pages can only be either base pages or HPAGE_PMD_SIZE. Ask the page what size it is. Link: http://lkml.kernel.org/r/20191017164223.2762148-4-songliubraving@xxxxxx Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") Signed-off-by: William Kucharski <william.kucharski@xxxxxxxxxx> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Signed-off-by: Song Liu <songliubraving@xxxxxx> Acked-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/mm/vmscan.c~mm-support-removing-arbitrary-sized-pages-from-mapping +++ a/mm/vmscan.c @@ -933,10 +933,7 @@ static int __remove_mapping(struct addre * Note that if SetPageDirty is always performed via set_page_dirty, * and thus under the i_pages lock, then this ordering is not required. */ - if (unlikely(PageTransHuge(page)) && PageSwapCache(page)) - refcount = 1 + HPAGE_PMD_NR; - else - refcount = 2; + refcount = 1 + compound_nr(page); if (!page_ref_freeze(page, refcount)) goto cannot_free; /* note: atomic_cmpxchg in page_ref_freeze provides the smp_rmb */ _ Patches currently in -mm which might be from william.kucharski@xxxxxxxxxx are mm-support-removing-arbitrary-sized-pages-from-mapping.patch