Skip to content

Commit

Permalink
mm/huge_memory: fix can_split_huge_page assumption of THP size
Browse files Browse the repository at this point in the history
Ask the page how many subpages it has instead of assuming it's PMD size.

Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: SeongJae Park <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Acked-by: "Huang, Ying" <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Matthew Wilcox (Oracle) authored and torvalds committed Oct 16, 2020
1 parent 65dfe3c commit e2333da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/huge_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2582,9 +2582,9 @@ bool can_split_huge_page(struct page *page, int *pextra_pins)

/* Additional pins from page cache */
if (PageAnon(page))
extra_pins = PageSwapCache(page) ? HPAGE_PMD_NR : 0;
extra_pins = PageSwapCache(page) ? thp_nr_pages(page) : 0;
else
extra_pins = HPAGE_PMD_NR;
extra_pins = thp_nr_pages(page);
if (pextra_pins)
*pextra_pins = extra_pins;
return total_mapcount(page) == page_count(page) - extra_pins - 1;
Expand Down

0 comments on commit e2333da

Please sign in to comment.