summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2020-09-28 13:36:00 -0400
committerMatthew Wilcox (Oracle) <willy@infradead.org>2020-10-26 14:17:19 -0400
commit37856373d8249b5a63a9f7d5b2bc9316bb64cd18 (patch)
treed6e07739c3af6840cb5c877339c92bfe7fd70200 /mm
parentdca55cefa3d4ebc722afcd6ec2d8517abbad4f32 (diff)
mm: Change NR_FILE_THPS to account in base pages
With variable sized THPs, we have to account in number of base pages, not in number of PMD-sized pages. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c4
-rw-r--r--mm/huge_memory.c4
-rw-r--r--mm/khugepaged.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 2985408019fe..dfcb449c54f9 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -193,8 +193,8 @@ static void unaccount_page_cache_page(struct address_space *mapping,
__mod_lruvec_page_state(page, NR_SHMEM, -nr);
if (PageTransHuge(page))
__dec_node_page_state(page, NR_SHMEM_THPS);
- } else if (PageTransHuge(page)) {
- __dec_node_page_state(page, NR_FILE_THPS);
+ } else if (nr > 1) {
+ __mod_node_page_state(page_pgdat(page), NR_FILE_THPS, -nr);
filemap_nr_thps_dec(mapping);
}
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 87460610b750..d09c0baf3ec3 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2727,7 +2727,9 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
if (PageSwapBacked(head))
__dec_node_page_state(head, NR_SHMEM_THPS);
else
- __dec_node_page_state(head, NR_FILE_THPS);
+ __mod_node_page_state(page_pgdat(head),
+ NR_FILE_THPS,
+ -thp_nr_pages(head));
}
__split_huge_page(page, list, end, flags);
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index c674ead8cdc0..6e5e7e35b50e 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1844,7 +1844,8 @@ out_unlock:
if (is_shmem)
__inc_node_page_state(new_page, NR_SHMEM_THPS);
else {
- __inc_node_page_state(new_page, NR_FILE_THPS);
+ __mod_node_page_state(page_pgdat(new_page), NR_FILE_THPS,
+ thp_nr_pages(new_page));
filemap_nr_thps_inc(mapping);
}