[PATCH] mm, page_owner: handle THP splits correctly

From: Vlastimil Babka
Date: Mon Aug 19 2019 - 07:38:29 EST


THP splitting path is missing the split_page_owner() call that split_page()
has. As a result, split THP pages are wrongly reported in the page_owner file
as order-9 pages. Furthermore when the former head page is freed, the remaining
former tail pages are not listed in the page_owner file at all. This patch
fixes that by adding the split_page_owner() call into __split_huge_page().

Reported-by: Kirill A. Shutemov <kirill@xxxxxxxxxxxxx>
Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
---
mm/huge_memory.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 738065f765ab..d727a0401484 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -32,6 +32,7 @@
#include <linux/shmem_fs.h>
#include <linux/oom.h>
#include <linux/numa.h>
+#include <linux/page_owner.h>

#include <asm/tlb.h>
#include <asm/pgalloc.h>
@@ -2533,6 +2534,8 @@ static void __split_huge_page(struct page *page, struct list_head *list,

remap_page(head);

+ split_page_owner(head, HPAGE_PMD_ORDER);
+
for (i = 0; i < HPAGE_PMD_NR; i++) {
struct page *subpage = head + i;
if (subpage == page)
--
2.22.0