From patchwork Tue Mar 22 03:22:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinan Zhang X-Patchwork-Id: 12788066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5537BC433F5 for ; Tue, 22 Mar 2022 03:22:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDB186B0074; Mon, 21 Mar 2022 23:22:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D8AA36B0075; Mon, 21 Mar 2022 23:22:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C51816B0078; Mon, 21 Mar 2022 23:22:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id B7C1F6B0074 for ; Mon, 21 Mar 2022 23:22:53 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6883818289F99 for ; Tue, 22 Mar 2022 03:22:53 +0000 (UTC) X-FDA: 79270575426.29.0DCE5EC Received: from smtpbg150.qq.com (smtpbg150.qq.com [18.132.163.193]) by imf06.hostedemail.com (Postfix) with ESMTP id 6849A180007 for ; Tue, 22 Mar 2022 03:22:52 +0000 (UTC) X-QQ-mid: bizesmtp89t1647919365tqpcupbm Received: from localhost.localdomain ( [202.96.137.239]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 22 Mar 2022 11:22:38 +0800 (CST) X-QQ-SSF: 01400000002000B0B000B00A0000000 X-QQ-FEAT: FXvDfBZI5O7hbJ92J2Pw4+Old7N4baRooH0on/achlelUnAVksJFu+/hbl/m0 IeBT6OyxULc1zgMpnGkHjsloDS9NDEvAzgX7gbTKID3vRAZewYTpYSwEHwLDF6Eh4bwVqPN zWsbRLSdOlKI9/aBDJ3rIj+bACJESNtxJRqgYZP5PgAYdkpWPIn+4L7YCtmBEsU5g5GGckE kQ9b+UaZUVHIjYPb8CKFHY++yH4jjRbyVNJBBBtwPhfb4wM6XUnpYwbWavIeUxz2FMss+Jk DLmrwSqV7CtS/U6Se9QjR6AvO/EQyFjPiTBFVUMuYqMlTuNX9t9W/Hk72psDwQ56jpYv5Yw JncbeWxax2jeBeny9yFxAixMQAl6UDFTtk8GJCi X-QQ-GoodBg: 2 From: Yinan Zhang 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 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 Message-Id: <20220322032225.1402992-2-zhangyinan2019@email.szu.edu.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220322032225.1402992-1-zhangyinan2019@email.szu.edu.cn> References: <20220322032225.1402992-1-zhangyinan2019@email.szu.edu.cn> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:email.szu.edu.cn:qybgforeign:qybgforeign10 X-QQ-Bgrelay: 1 X-Rspamd-Queue-Id: 6849A180007 X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of zhangyinan2019@email.szu.edu.cn designates 18.132.163.193 as permitted sender) smtp.mailfrom=zhangyinan2019@email.szu.edu.cn; dmarc=pass (policy=quarantine) header.from=email.szu.edu.cn X-Stat-Signature: bq19p9ewuysxqruzgnoyunjwffoxqyrb X-Rspamd-Server: rspam07 X-HE-Tag: 1647919372-416008 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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 #include #include +#include #include #include @@ -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: