From patchwork Wed Oct 18 14:07:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13427156 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 91934C46CA1 for ; Wed, 18 Oct 2023 14:09:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A455E80071; Wed, 18 Oct 2023 10:09:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F8108006D; Wed, 18 Oct 2023 10:09:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 848B180071; Wed, 18 Oct 2023 10:09:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7594F8006D for ; Wed, 18 Oct 2023 10:09:39 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3D97B1601FB for ; Wed, 18 Oct 2023 14:09:39 +0000 (UTC) X-FDA: 81358765278.06.B50A8B1 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf09.hostedemail.com (Postfix) with ESMTP id B931F14000C for ; Wed, 18 Oct 2023 14:09:36 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697638177; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=42AZB0UhRDkADivyLQI4LDJLes6XAOA7/Y7eZodG6fA=; b=ivltJRNOSTOZYawFxJdAVykekoQ81jzv+SJda/g940uU5sforA3FdlG0+U197BrMzv7r/4 WlaKsv2I9A0h30wxx8fSAkaGgFgwCR5igr8yfXVnY4LvwVdTGill2UfT8Jr11V8NW+/QPJ +Vrhh+Q2SlQkU97JnmdNrjVxUAUpIK0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697638177; a=rsa-sha256; cv=none; b=Qgw7YmHfFrsldJyaZOvVJv00pFeLJ7VeC6p9fPGhL2Ys03RdXtfg834JU3bsVWJ0QneR9M 73Hm7iN+HinGmzN2+525/7ebcq9kmaX1MrWMQKkajNsTmUuLp+Lftekh5o4V7Ay/RAl1qv qchNr8SBRa40NoCctvIwcg4X532I8ZE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9Xh81z84zrTMP; Wed, 18 Oct 2023 22:06:16 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:08:59 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 01/19] mm_types: add virtual and _last_cpupid into struct folio Date: Wed, 18 Oct 2023 22:07:48 +0800 Message-ID: <20231018140806.2783514-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B931F14000C X-Rspam-User: X-Stat-Signature: c969u366zdynauymk951m8ng8xmuzd3y X-Rspamd-Server: rspam03 X-HE-Tag: 1697638176-710609 X-HE-Meta: U2FsdGVkX1/RtL9KWz/AKl+Ir3dNBC0eqM2XoCfY/ZGjd/7e1N7it9W0jHj1aeRTpdjyeoi1DyyT4OJ56OX4cr9Zv87uqeBc7Ie8uk2YlwgVOCLVwclK35k8rjwSoh76UuP8/YR0b5q/ME756/0MkAaLbexTbuKzvLJDYxMF4jagz9ZDnSVWTL7nFNUpLmXIB5N7y20ofrlm63R8A39SoqNKPws+pmKdvrM8k9odOSADrBe3FeWswd9bYqr1RnOItNpg/K3H9Yl/6VuDNYvLtMwjxC5dFdIG2jWISZDr64xHtIU4trWD/Twp3IWQjbV2frNKJFSgToq5KeDplV7q07iCocqYdQ2HnIuxm22GWQAc+q7hCGcXf6w9XNcO8vWQRZabVGT1/d/9YbPAKcxFqg9qhtDXs1beCv1yw1pHQ/MmuwdVKtElbSRsOlX08sefl4zr87fxYLNrg45l3BNtpaK4ige6a7Y8ncw0BkydXfaequgLBqgCqQuw1UefSU0GPOZMcUFICr8COiiCQt/uTHGM1Q3x5vTva05+5Dkd2DngFJvv5o6BboWY1acENmKWR85ypI8Y/aVefhXUXkUjp5CCDowdcXD0MQ0Y3bzzHUEbEgt5pRI2r9AaVAQpLv4AbiGY7fMriugdnsf4yS94EtboIU0Lcy8QVEmGqty7A3v7JXHzPjrH+PFjQI80+qPZY8ofcBLY5HimwJYiE5k3dw0Y1T/WlGyy4CHk9YIWWMDKguqsfhd6tGYInego3TTeVpUdZ2hMvES9+Ck16TfKYuPZzcnFCunL4/uFweo95v0VKrtow8VVMlqFyf2Ghmk9MQkU6swXfdV34EU70zC0FbJ1cwYN3a+t6nlnQtrEgzHThrCIsXK8J1k45xZRXYtYXQBF/aPJ5iKnoX/PUa8wvpDxLZdYLkkRPFyRUqkQ6dT8iP9DxStVG1MFV50JkYiAjNtgYyNpPx5Hgq/lvMQ 5a3VEkAq Geu5sw1t+1DfYWP3KnxIRPa/qT+rZfatS4jcuoY4GQP0ipxa/+bVez8AhkEujp84MJnG7/WTPTMQ5PtrXCeyvfxdw1W7yN6MDRD3Z2gNS4xUOqq2ibVOPsugmtOiB6Q2LfJvcJTXu69OVW8gvFX6eWqs3goG0Fi1LwI9XuuuQHyvfdQLcuaNdE9pLN1oeRmTL4dzFbH2K27fFQfS7uxCBARlZmqaz3dQ0KSMoaGX+YXpjbAEm/qFgcQaiIGbVilf0nQ4aj7f1RyjXALh/JQqHLNuv5ZNykS+xd7K7 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: If WANT_PAGE_VIRTUAL and LAST_CPUPID_NOT_IN_PAGE_FLAGS defined, the 'virtual' and '_last_cpupid' are in struct page, and since _last_cpupid is used by numa balancing feature, it is better to move it before KMSAN metadata from struct page, also add them into struct folio to make us to access them from folio directly. Signed-off-by: Kefeng Wang --- include/linux/mm_types.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index cc8bb767c003..34466be945a9 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -199,6 +199,10 @@ struct page { not kmapped, ie. highmem) */ #endif /* WANT_PAGE_VIRTUAL */ +#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS + int _last_cpupid; +#endif + #ifdef CONFIG_KMSAN /* * KMSAN metadata for this page: @@ -210,10 +214,6 @@ struct page { struct page *kmsan_shadow; struct page *kmsan_origin; #endif - -#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS - int _last_cpupid; -#endif } _struct_page_alignment; /* @@ -272,6 +272,8 @@ typedef struct { * @_refcount: Do not access this member directly. Use folio_ref_count() * to find how many references there are to this folio. * @memcg_data: Memory Control Group data. + * @virtual: Virtual address in the kernel direct map. + * @_last_cpupid: IDs of last CPU and last process that accessed the folio. * @_entire_mapcount: Do not use directly, call folio_entire_mapcount(). * @_nr_pages_mapped: Do not use directly, call folio_mapcount(). * @_pincount: Do not use directly, call folio_maybe_dma_pinned(). @@ -317,6 +319,12 @@ struct folio { atomic_t _refcount; #ifdef CONFIG_MEMCG unsigned long memcg_data; +#endif +#if defined(WANT_PAGE_VIRTUAL) + void *virtual; +#endif +#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS + int _last_cpupid; #endif /* private: the union with struct page is transitional */ }; @@ -373,6 +381,12 @@ FOLIO_MATCH(_refcount, _refcount); #ifdef CONFIG_MEMCG FOLIO_MATCH(memcg_data, memcg_data); #endif +#if defined(WANT_PAGE_VIRTUAL) +FOLIO_MATCH(virtual, virtual); +#endif +#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS +FOLIO_MATCH(_last_cpupid, _last_cpupid); +#endif #undef FOLIO_MATCH #define FOLIO_MATCH(pg, fl) \ static_assert(offsetof(struct folio, fl) == \