[PATCH 2/2] mm/vmalloc.c: record the allocator in page_owner when __vmalloc_area_node complete mapping pages to virtual address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx>
---
 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







[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux