Skip to content

Commit 906d278

Browse files
William Kucharskitorvalds
authored andcommitted
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@fb.com Fixes: 99cb0db ("mm,thp: add read-only THP support for (non-shmem) FS") Signed-off-by: William Kucharski <william.kucharski@oracle.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Song Liu <songliubraving@fb.com> Acked-by: Yang Shi <yang.shi@linux.alibaba.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 06d3eff commit 906d278

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎mm/vmscan.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,10 +933,7 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
933933
* Note that if SetPageDirty is always performed via set_page_dirty,
934934
* and thus under the i_pages lock, then this ordering is not required.
935935
*/
936-
if (unlikely(PageTransHuge(page)) && PageSwapCache(page))
937-
refcount = 1 + HPAGE_PMD_NR;
938-
else
939-
refcount = 2;
936+
refcount = 1 + compound_nr(page);
940937
if (!page_ref_freeze(page, refcount))
941938
goto cannot_free;
942939
/* note: atomic_cmpxchg in page_ref_freeze provides the smp_rmb */

0 commit comments

Comments
 (0)