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: 152406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751497vqb; Fri, 13 Oct 2023 01:58:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECYa09Rg7/0ZjQA82p7/17jX3cEtoli3uilFQ1bAk40ZArS2KFvOGSG3YFpbOpnVfJWqxR X-Received: by 2002:a05:6a00:1da7:b0:6b5:523e:9e9 with SMTP id z39-20020a056a001da700b006b5523e09e9mr260004pfw.3.1697187516250; Fri, 13 Oct 2023 01:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187516; cv=none; d=google.com; s=arc-20160816; b=WVKJNPueCivEj/o/sRN087HFaTwFiR2B+UYIF8FmBTF7sfLHy62PFMlxxejRNCVtHF D4wiSLPFmpIUmRh+YzYBnlhJtiRqc/wxqhdRIIC6CEWDG5r0B5D9Edg/9U/Y0Fj/JNcV o4r2ptlOm4iu19Cs0QeBiaMxq5N7JYu9E6zdbrq/rdL4mxIzWMes5I5MVGONMdzBI0Ir GOWow2mzMkOUBfV7YT7v0CRiFFlc6aGDoKgN6Em4ORvEyNPmbjqPazNycIQtfVNWoHfJ z6mQRubRqdANr1KPnm9SFviabYz7tiZpn/BmSiKaViXbZHV1qK7MDrit6i2lkjwUsWms ZT8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=42AZB0UhRDkADivyLQI4LDJLes6XAOA7/Y7eZodG6fA=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=aTrnhcaslsnNR9+ac7SegP0C6Gr0bNR5VfDD3qO6XZmtSx6Rx/TwZZaIOAyC/MFCkH 15Xr9vNyQ33XDVqmz/si4sE6syzaxA9TUTNc+ZMvH7eDBxZ46SvX3esQ8ffU36knSwnx YfbbfYB+XqBi+aUsD2yIoHmcNT33dtFFtjM6JnmSwPRO+U2I2kdXqVJpnPVe8as9hya1 RHOS9t2kpWdAgdUU/ELb/3+WTWmSJGoSD+dHG5pB2r12JEDCzmIx+knOO2LBn1B4QAQM HqtgmPx/E7JpWjLap9yeZ3YkVqhIqsceN6Z3KdhsKUKH5NN0uaI1V34v5zDz36o18v7g nSBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cq27-20020a056a00331b00b0069018a768d7si12114526pfb.385.2023.10.13.01.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:58:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9F47282F08D5; Fri, 13 Oct 2023 01:58:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbjJMI63 (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjJMI60 (ORCPT ); Fri, 13 Oct 2023 04:58:26 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E2DBE for ; Fri, 13 Oct 2023 01:58:23 -0700 (PDT) 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:58:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630096915158720 X-GMAIL-MSGID: 1779630096915158720 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) == \