diff mbox series

[01/11] mm/filemap: Fix page cache removal for arbitrary sized THPs

Message ID 20200908195539.25896-2-willy@infradead.org
State New
Headers show
Series Remove assumptions of THP size | expand

Commit Message

Matthew Wilcox Sept. 8, 2020, 7:55 p.m. UTC
page_cache_free_page() assumes THPs are PMD_SIZE; fix that assumption.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/filemap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kirill A. Shutemov Sept. 9, 2020, 2:27 p.m. UTC | #1
On Tue, Sep 08, 2020 at 08:55:28PM +0100, Matthew Wilcox (Oracle) wrote:
> page_cache_free_page() assumes THPs are PMD_SIZE; fix that assumption.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
SeongJae Park Sept. 15, 2020, 7:13 a.m. UTC | #2
On Tue,  8 Sep 2020 20:55:28 +0100 "Matthew Wilcox (Oracle)" <willy@infradead.org> wrote:

> page_cache_free_page() assumes THPs are PMD_SIZE; fix that assumption.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Reviewed-by: SeongJae Park <sjpark@amazon.de>

Thanks,
SeongJae Park
diff mbox series

Patch

diff --git a/mm/filemap.c b/mm/filemap.c
index 1aaea26556cc..c60b94fd74ec 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -249,7 +249,7 @@  static void page_cache_free_page(struct address_space *mapping,
 		freepage(page);
 
 	if (PageTransHuge(page) && !PageHuge(page)) {
-		page_ref_sub(page, HPAGE_PMD_NR);
+		page_ref_sub(page, thp_nr_pages(page));
 		VM_BUG_ON_PAGE(page_count(page) <= 0, page);
 	} else {
 		put_page(page);