From patchwork Fri Oct 13 08:55:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13420519 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 09CF1CDB483 for ; Fri, 13 Oct 2023 08:58:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 740AC8D0015; Fri, 13 Oct 2023 04:58:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C88D8E0006; Fri, 13 Oct 2023 04:58:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 542548D0160; Fri, 13 Oct 2023 04:58:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3E7A98D0015 for ; Fri, 13 Oct 2023 04:58:31 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 06BB9801CC for ; Fri, 13 Oct 2023 08:58:31 +0000 (UTC) X-FDA: 81339837222.04.B5F8A62 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf07.hostedemail.com (Postfix) with ESMTP id 1F5B440008 for ; Fri, 13 Oct 2023 08:58:27 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697187509; a=rsa-sha256; cv=none; b=G+xpB7X5pTjzhiegI3DgTvVjnvIcwQx34hMaP2xp/YUftSPsQwuDW5YmAEZY5ojJgU91VG RN3h4MhONc6T0YWrGU58xj49um53Sez1/Y0V0+fbB2b5A/312GpDnchM4gNkhX4hWEHksc yIwvuSpI8S2pOhZMB3UCrCVykmSmX7Q= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697187509; 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=mYFuEcXdGkZLoj5FX5wUo/sjrydcTHqM1uJ2/t6GBcjJX1yygg3/puiQE9Ont4oZz4MpmC 10irEORzAjHdVhx4iFISHYtp/CYmXsoVt60vZgc6Cevhw7mlqmLIczIjj2kxG5DVqqsWUW yuhdA/lRxDc5ch+NyBj9xFgnFQ6EGYY= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L0d07JpzLqTL; Fri, 13 Oct 2023 16:54:25 +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; Fri, 13 Oct 2023 16:58:21 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 01/19] mm_types: add virtual and _last_cpupid into struct folio Date: Fri, 13 Oct 2023 16:55:45 +0800 Message-ID: <20231013085603.1227349-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231013085603.1227349-1-wangkefeng.wang@huawei.com> References: <20231013085603.1227349-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1F5B440008 X-Stat-Signature: hpiddjqhshnfhfjufmygdht4xbgwksem X-Rspam-User: X-HE-Tag: 1697187507-579634 X-HE-Meta: U2FsdGVkX18nyz55QL3jJinjpQhtQzHo4zw7O+oteMus/c/cZC2M6hYyxgUG4nJuVZ2nlwHbkOx/2Gl7SxNcGmEyDFgY77t9PT7+CJdazRczqg49rPC4uoqTnBtQZ+aMmpfo6lF2/SS9RJLaheFtQtd1xaOKOpVw/3WYHyhUpLdrPz2wUsrG0UeCfSVzGE+2Np73D4DhLUajdJ0rvcKRTae8vRSn2fDuwJ4JeTw2PcBG7fpeT07Kl6P3jayNcr8u7MGJ7p/4IyUTB8hSU7RNLOySBBv7Wz2eKBSl96+m6w/0jp2jbqGLwg76NmxHgWzBvVBY+4z8upKdJxxh6Fmi0lGxpFm4CENxohXDDWy/BqbHwjieF7bnchF1sAOCVx72z2NdJ1NOVeDLelOWlExu25sLi+0UpF7s3ORX/LBlWHRJKQBn5QvnP11/jMMSX67EcQufgGoZDIU+4kZuQF5dNmOGppq/1/jCrcrb44R9LRchNWFp2FQRMPfC21qzpm4ccH2s5zNoCwkGCDOXgNM+AtHIEVbReCGdE+MfVnILVApsca7/knVLpinJDg7rt8WgT648WyxhibYN85EToG5QBLGqDpgTofKdQ+aidygaitA7/BI7nXUi2bK/tMc4ir0DMMoaiAvKRj3qPjLuwGKLoTKLF9Baq0+f5EGjG+oVFAz2rQKbuZBTxrOwnNEniFec1Jy5WQ+3NbjxtvM6XA/w4Guw7Gk4QLNDQhg7T6808DNba+ivcae6qQk9gm+hV4ugPjMjzKRx6rnMUOrNl6fT5VfwrPuz7IbKIMzyYgHbHz0U9beQkZEAfrSuWGX+IsIzfd5+joGssJoOe75zKMBvVfE9l6nuk2vX/+uft6J7vKQQ8agIbmgvTQmwSZD4oP8dUXzo7GXZXmpAZ30B62joM36r8ZHCUh1CEMYzSVNv+V/hIKI5Pwhoa/Zo7w5ngNf4pwrCbkCl2036yEMkuae Uc6bVIxB pCxdCJKSH6kfhvH8dir+388sktSTJs0b8TaT43zKrPnFKN36IziqXqYjhMR1/JOlKt/9BOSTc2KfK8wttvt93TsBJc9jbc3AOPKfvzJZrRUdczylgY/b113adq8gf+RhYzRBn05L0iUJXcrXk4qW/FJaE6h1whfNQm6I/6pR2YQgNtVLKBGfUuuj0YQU3U7slGFJq 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) == \