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: 154885 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4817698vqb; Wed, 18 Oct 2023 07:09:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFLt1SQDwmTzmJtbGEB1s10ovtQeETW1LUdy/ehkrU2IiseyWgUBQ49JU2cMaeXVKoXIHS X-Received: by 2002:a17:90b:4c91:b0:27d:3b8:a08a with SMTP id my17-20020a17090b4c9100b0027d03b8a08amr5734446pjb.1.1697638159593; Wed, 18 Oct 2023 07:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638159; cv=none; d=google.com; s=arc-20160816; b=WwMwT90jy6C4P6mnRBRnX9U7Qdb11HGy4+6MN6VrbopIIJO8gJnG43Aw/bHQ5SEnG1 f+pre1+a3WJKNOyt81XOIe0uBr+OUcWb7aJq3wwUArEeo5krcAaK2uaoU5S0sm/mA4Vx pyu/GDPeYnNK7tONOq2j009Mf4WnEgvmi9oXya8O/NFxY/rq31kt/qtgQtgDbgrq329n yxPds1eyz+5hYOeVfqna5fueWvYQ/5rXYetB6o69ukpiFvG+OstHp2FLaIMG/7AY65Fe aMGSRcsNGr91+ooDCGwCNdMU8+vnQ4N1UiFe/555EMbJAqjlqc00XyJlxRMsxv1+wILv 1fhg== 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=Q4ahjVmpAhiSNGX/UjGG3N+lmwCf0U72h5bF4awXsnD4eoND1bfAXHDGSuubQ5N5Pg TlnmcuYF0iGPcMZrlD/QdpqjG8BP3SRR0GI1E6nyElQJjIcVyhDnqVbX2Rfcdb4A3P4m +UJ+BWxbgUOcwWNstLL82GJuV1KYBEBkXBFH4p+f7TL4sjCCL3/tmP7+3SgQIgbakDA3 3lSXMP40FMzS+h/MdR0G7bEepLBnewt3dmDwvm4ba+NH+WaoQg5zx+hkF0qGGWVnPBK3 5SewyO5spQk5a0dkK41rlyAnf8UwL5qlZDg68B9rRVMmCOO2sl8VuojSmUCC3eEEPczE iLeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ls8-20020a17090b350800b00279202f4151si1739936pjb.45.2023.10.18.07.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 18E09812DBFB; Wed, 18 Oct 2023 07:09:18 -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 S1344866AbjJROJM (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344828AbjJROJG (ORCPT ); Wed, 18 Oct 2023 10:09:06 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D421110D for ; Wed, 18 Oct 2023 07:09:04 -0700 (PDT) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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]); Wed, 18 Oct 2023 07:09:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102630609828258 X-GMAIL-MSGID: 1780102630609828258 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) == \