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/[email protected] Fixes: 99cb0db ("mm,thp: add read-only THP support for (non-shmem) FS") Signed-off-by: William Kucharski <[email protected]> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Song Liu <[email protected]> Acked-by: Yang Shi <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Srikar Dronamraju <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 06d3eff commit 906d278

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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)