linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yinan Zhang <zhangyinan2019@email.szu.edu.cn>
To: akpm@linux-foundation.org
Cc: willy@infradead.org, vbabka@suse.cz,
	william.kucharski@oracle.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, yejiajian2018@email.szu.edu.cn,
	hanshenghong2019@email.szu.edu.cn,
	caoyixuan2019@email.szu.edu.cn, zhaochongxi2019@email.szu.edu.cn,
	yuhongf@szu.edu.cn, Yinan Zhang <zhangyinan2019@email.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
Date: Tue, 22 Mar 2022 11:22:25 +0800	[thread overview]
Message-ID: <20220322032225.1402992-2-zhangyinan2019@email.szu.edu.cn> (raw)
In-Reply-To: <20220322032225.1402992-1-zhangyinan2019@email.szu.edu.cn>

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@email.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





  reply	other threads:[~2022-03-22  3:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22  3:22 [PATCH 1/2] mm/page_owner.c: introduce vmalloc allocator for page_owner Yinan Zhang
2022-03-22  3:22 ` Yinan Zhang [this message]
2022-03-22  3:28 ` Matthew Wilcox
     [not found]   ` <299aef9a-dd57-2197-f3cf-6b08c441f755@email.szu.edu.cn>
2022-03-22 15:10     ` Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220322032225.1402992-2-zhangyinan2019@email.szu.edu.cn \
    --to=zhangyinan2019@email.szu.edu.cn \
    --cc=akpm@linux-foundation.org \
    --cc=caoyixuan2019@email.szu.edu.cn \
    --cc=hanshenghong2019@email.szu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    --cc=william.kucharski@oracle.com \
    --cc=willy@infradead.org \
    --cc=yejiajian2018@email.szu.edu.cn \
    --cc=yuhongf@szu.edu.cn \
    --cc=zhaochongxi2019@email.szu.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox