History

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.

William Kucharski committed 7 years ago

Commit 906d2781 parent 06d3eff1 file · +1 −4Browse files

Unified · Split

mm/vmscan.c+1−4
@@ -933,10 +933,7 @@ static int __remove_mapping(struct address_space *mapping, struct page *page, · 932 unmodified lines
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 */