[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220322032225.1402992-2-zhangyinan2019@email.szu.edu.cn>
Date: Tue, 22 Mar 2022 11:22:25 +0800
From: Yinan Zhang <zhangyinan2019@...il.szu.edu.cn>
To: akpm@...ux-foundation.org
Cc: willy@...radead.org, vbabka@...e.cz, william.kucharski@...cle.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
yejiajian2018@...il.szu.edu.cn, hanshenghong2019@...il.szu.edu.cn,
caoyixuan2019@...il.szu.edu.cn, zhaochongxi2019@...il.szu.edu.cn,
yuhongf@....edu.cn, Yinan Zhang <zhangyinan2019@...il.szu.edu.cn>
Subject: [PATCH 2/2] mm/vmalloc.c: record the allocator in page_owner when __vmalloc_area_node complete mapping pages to virtual address
page owner is for the tracking about who allocated each page.
Recording the allocator in page_owner requires support from vmalloc.
When __vmalloc_area_node complete mapping pages to virtual address,
it means that the memory allocation is successful. At this time,
call set_page_owner_allocator() to record the
allocator (in this patch, it's vmalloc) in page_owner.
This work is coauthored by
Shenghong Han
Yixuan Cao
Chongxi Zhao
Jiajian Ye
Yuhong Feng
Yongqiang Liu
Signed-off-by: Yinan Zhang <zhangyinan2019@...il.szu.edu.cn>
---
mm/vmalloc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index b454cf1a261f..c561d40a3f95 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -40,6 +40,7 @@
#include <linux/uaccess.h>
#include <linux/hugetlb.h>
#include <linux/sched/mm.h>
+#include <linux/page_owner.h>
#include <asm/tlbflush.h>
#include <asm/shmparam.h>
@@ -3051,6 +3052,13 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
goto fail;
}
+#ifdef CONFIG_PAGE_OWNER
+ int i;
+
+ for (i = 0; i < area->nr_pages; i++)
+ set_page_owner_allocator(area->pages[i], 0, PAGE_OWNER_ALLOCATOR_VMALLOC);
+#endif
+
return area->addr;
fail:
--
2.25.1
Powered by blists - more mailing lists