summaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2020-10-15 20:05:23 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-10-16 11:11:15 -0700
commit887b22c628c615811be3b877e02c9c1fe9d85d6d (patch)
tree2a8b8ef999f838cfd979af15cd793323d9beb10f /mm/filemap.c
parent198b62f83eef1d605d70eca32759c92cdcc14175 (diff)
downloadlinux-stable-887b22c628c615811be3b877e02c9c1fe9d85d6d.tar.gz
linux-stable-887b22c628c615811be3b877e02c9c1fe9d85d6d.tar.bz2
linux-stable-887b22c628c615811be3b877e02c9c1fe9d85d6d.zip
mm/filemap: fix page cache removal for arbitrary sized THPs
Patch series "Remove assumptions of THP size". There are a number of places in the VM which assume that a THP is a PMD in size. That's true today, and remains true after this patch series, but this is a prerequisite for switching to arbitrary-sized THPs. thp_nr_pages() still returns either HPAGE_PMD_NR or 1, but will be changed later. This patch (of 11): page_cache_free_page() assumes THPs are PMD_SIZE; fix that assumption. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Huang Ying <ying.huang@intel.com> Link: https://lkml.kernel.org/r/20200908195539.25896-1-willy@infradead.org Link: https://lkml.kernel.org/r/20200908195539.25896-2-willy@infradead.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 3b76d79fd0cf..2937b57329be 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);