Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2451494pxp; Mon, 21 Mar 2022 20:57:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAxI1mC1M66rAMtV+V8ajOPY9RsS1IRjDjTio+9TZuNA3RrW+xCWkqrFwdxCkCi3Z6U+kr X-Received: by 2002:a17:903:41d1:b0:153:b1ac:a25f with SMTP id u17-20020a17090341d100b00153b1aca25fmr16120945ple.69.1647921444486; Mon, 21 Mar 2022 20:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647921444; cv=none; d=google.com; s=arc-20160816; b=Fu/mlpTOcOCV57zEoVR8BXfXL9MPRY/9YsYsSp5hn0UNHrSyfb74fRi2yn6Qbjo55m rEvG/ku8Tx2EUwm1oFflYyxJ6CYm1LAsFoEs2IYIo6dNWbL9viry5Tk/XgrpfTYS5OcF PVpU18jWhscKb0yrQWLTuNobuFbm0oLY5EBjkW5sG4eXAglhclCkP363XZfgYd2oTMhh AevBs8AFuwn5ERIO2xguCKdIreRPadocdtqtp6Ym593Px91BvMu/DiV3I/Qco4GSEnO8 GGXWXnx65KkqyqcDB0fV48UtcmlduEpw9yXkReyDrbflj8v8dvKEivl20x60JOCWEC78 010w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=yENbO7x8G2T7Lnwj8Z3cEdamFdJ7KNxbjQ+5c44hi1I=; b=La3qge7rO5rZBdQYyVI8MgfB7rS/PC3zn7+ajTMi/GnfciSNmamyVdPvy/HORXg+hD bWW+ass8gr4XFczmXEWr0yTLewYsK3MhCpEDKFP3kJ2+CtnpqCsSd6kau163mGdowByo S552fpEMIYXGJXj3q2ep/wT0SZKmpuWWcf1Z9BtKpB3fa9Lo1HyQDAOBEsmiBAdkHI1G QZSIPajjfGYg+23LKKoghDVbnS1GwoyHzOdgeerjeaMtYR0JTKsIw+rG9kk9ZOGqAEUy NqfdfOf7wCPWMdxmOBDqMOSt78ccK0l/lUt3mlTKXwN+jEjME+4LD/tMyjLHuB/oPEAA aNYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=email.szu.edu.cn Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h9-20020a170902b94900b00153bd1573c1si12337076pls.85.2022.03.21.20.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 20:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=email.szu.edu.cn Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34DA55C356; Mon, 21 Mar 2022 20:23:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236152AbiCVDYh (ORCPT + 99 others); Mon, 21 Mar 2022 23:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236131AbiCVDY3 (ORCPT ); Mon, 21 Mar 2022 23:24:29 -0400 Received: from smtpbguseast3.qq.com (smtpbguseast3.qq.com [54.243.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB3AE5AA53 for ; Mon, 21 Mar 2022 20:23:00 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:email.szu.edu.cn:qybgforeign:qybgforeign10 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: -- 2.25.1