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) == \ From patchwork Fri Oct 13 08:55:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751602vqb; Fri, 13 Oct 2023 01:58:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRjKZ//s80SaAxK6K3NJlVKd6djfAfdTQHpMBCmTytSOKV1eKGl6276APGXRucbwB1wrDk X-Received: by 2002:a17:903:2306:b0:1bb:ac37:384b with SMTP id d6-20020a170903230600b001bbac37384bmr29315464plh.6.1697187537697; Fri, 13 Oct 2023 01:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187537; cv=none; d=google.com; s=arc-20160816; b=M7TtGEwzdEW7wGSzv2iUZOdYxS+G6AxU5EHvfKBh/H8KrDTunYQasgNMsbKjzOysXQ S7E18ksQ1TUzTVvDYjpioL/ynIWly1R4AgwxBiBTxIxodDsXIT32DkZGGQVRoJ3xkDx3 i197sL5nqxq/2+5Pq2yZCUXGbS4hXL6NNJKOU4kA+oaO3GeXnWp2t9i80LwAJO+ZRIgE 748ndt5oBtILXkiHirXbyaO8jVKpDo+LqlsjFDSDNOHbJW4xrGIUJL/Bs2dwA7snMEd7 tdedIHOlDYZtxCKzGlxhWskSd2bl2hJqCvyA3KNouSMJS4ytXm1wLaaMiKSA/RDhg+zN MllA== 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=z3XKsRcFGkwnebwYgONpauQeYaDIMFmQ038Pa3oEk3k=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=rVahqsuP7nqv2t/N5kurzEngOuTZHHPO/oBjn3xJ3WXz5oFNbWWh/k6vDozjMwWnCJ JN7famKbgokreTPVNOs394F5i8ekBza9TJtOv/x309Bv6q/xFTsM9u+OW8q9JWzD8hYt TqCPaDh/Ttm9+T8YJVgX6Ux1tB7Lu1hdwuEwQJcReScf6tbraET9NfN5RzZLekjsj+qT sUxLFgtrRG+Qutl/wkJFFMjBqDQbe464+3RwiEQnL8RPMc+WnKJW45TwOhGJ2/qbLWju AdYhnFrX7R0TnenKux28IKRvXwMN146UYh/edMgtjTI+fDXAAd9s4wgldirQ5naPYhqw lNAQ== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id x15-20020a170902820f00b001c5ff477ebcsi3821608pln.265.2023.10.13.01.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:58:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 8AB2582B90D8; Fri, 13 Oct 2023 01:58:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230382AbjJMI6g (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbjJMI60 (ORCPT ); Fri, 13 Oct 2023 04:58:26 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48310BF for ; Fri, 13 Oct 2023 01:58:24 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6L295KkrzrTQP; Fri, 13 Oct 2023 16:55:45 +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:22 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 02/19] mm: add folio_last_cpupid() Date: Fri, 13 Oct 2023 16:55:46 +0800 Message-ID: <20231013085603.1227349-3-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:58:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630119364779718 X-GMAIL-MSGID: 1779630119364779718 Add folio_last_cpupid() wrapper, which is required to convert page_cpupid_last() to folio vertion later in the series. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index d005beccaa5d..1c393a72037b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1794,6 +1794,11 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ +static inline int folio_last_cpupid(struct folio *folio) +{ + return page_cpupid_last(&folio->page); +} + #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) /* From patchwork Fri Oct 13 08:55:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751684vqb; Fri, 13 Oct 2023 01:59:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCVnTMyKuFnfh50cMTbm0OL0IAweHE3FQk+Y1AriuaPc04MDon4PQRnShf0igy5Q8u6JuH X-Received: by 2002:a05:6a00:2d1b:b0:68e:3eff:e93a with SMTP id fa27-20020a056a002d1b00b0068e3effe93amr28282565pfb.2.1697187549081; Fri, 13 Oct 2023 01:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187549; cv=none; d=google.com; s=arc-20160816; b=oqe4BaEJsCV3meGKOpSgbXOmkiLDzexHRAJXcpc88gt9S0Z0xxJ+94efNTs+YzXmXn jpB0jsAUeoU/4DBgwRNFahSBdm8M6m0+BJnvKcWJgD9p/2qjpRQpuMFvFiBHhqjtI1S2 JWmRtJw+WDIZGkHwWys5NDqMZF1bpShWXRbl2HNAA2WVaqddAfORcEvI17N0rKNIhmQA KAHEuuDn0Lgj1rYQ818L+AZBk6zxyRXBYaN37ZEs8WCKhVsJeA7XBU9oVJp0PhDQdzcs NsebMGg03Ju09vVK/wRUGnalh412zq2hQj9LOVvdOK0xmScY31r1uUimN2Ssk9aRfTGx ctxw== 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=y9mdiRTkF16A23MSwCD/zcfcV62lDhs7zm5d0Ve5GvQ=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=yVGPXf8wOdhMv8qltz8uZpmh2eLO0uTLs9XJhd8PPPrQZnAggoc0qXXyl5OGdj2cUw 5q/4WWdXTxtM+uOxb2TtK3XogBSmFzVfkncISpN7lj4OWrDfG4/0MrCKmAMYd1NQRXtP FodM2zBeP72V19QIDkp3tcmMeh+q7Ej5nOqq/5Xe+JFOMKgrQlAm2xa/dwxsYCV+nidG DrU+YphIUKMXMSk8bnAcvtF9RsBz1NSonF2Adb597uPACUD90G6k/2opwigCWPRAC75q ztIntsjE91oVxNpifbk5zoJYJfaBsuvBGyp1x1qG83TI1pN9QbfSqzev+8edDt0T+AMg Eceg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id f11-20020a056a00228b00b006b4d80642bbsi375924pfe.182.2023.10.13.01.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id D3AA581B5AB5; Fri, 13 Oct 2023 01:59:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbjJMI6c (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbjJMI60 (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 BAFDFC0 for ; Fri, 13 Oct 2023 01:58:24 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L163Z56zVlTh; Fri, 13 Oct 2023 16:54:50 +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:22 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 03/19] mm: memory: use folio_last_cpupid() in do_numa_page() Date: Fri, 13 Oct 2023 16:55:47 +0800 Message-ID: <20231013085603.1227349-4-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630131383357785 X-GMAIL-MSGID: 1779630131383357785 Convert to use folio_last_cpupid() in do_numa_page(). Signed-off-by: Kefeng Wang --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index c4b4aa4c1180..a1cf25a3ff16 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4861,7 +4861,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) !node_is_toptier(nid)) last_cpupid = (-1 & LAST_CPUPID_MASK); else - last_cpupid = page_cpupid_last(&folio->page); + last_cpupid = folio_last_cpupid(folio); target_nid = numa_migrate_prep(folio, vma, vmf->address, nid, &flags); if (target_nid == NUMA_NO_NODE) { folio_put(folio); From patchwork Fri Oct 13 08:55: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: 152407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751564vqb; Fri, 13 Oct 2023 01:58:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBfHy0smug3Rx1qK58lukMabWcC0+QIhgmnMTg5VG3vIQklz3a1pmOSQCNWVgTesMi5HkW X-Received: by 2002:a25:3002:0:b0:d9a:fdc8:a0ca with SMTP id w2-20020a253002000000b00d9afdc8a0camr1643430ybw.1.1697187528600; Fri, 13 Oct 2023 01:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187528; cv=none; d=google.com; s=arc-20160816; b=sI2dAmkVzJPpZ0UNMV1Dj3SAT038+/o00mkqwACu0GG7y+AMOEI8pXFjhrUhPBLiCy +StREDa9fEOtffqzz53D6G+UVDkTZf4jC/PQQhHJdFZk6MfeLNLfym5E6HUPyW3c8IGz 9Q8jxzmAbIPfa1uBbMECu2rpIVIIkMQ6ZBxHeALTc0Ggn0kmFkJMREfyhkihyUe/ZlbD htNvVU8LaBSiYvOvzkM/dJrG5VuRruhucYaUAZfXY5h8FuBJG2SVGVKmz2TJ44BKaUrl RqKO0jKLVfDwPOMWrz7f11R80wG4LG0KHhF46yMLG/H1RuEpt7jClp6VVJt7p9EHGjEM 44OQ== 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=CXnUonKq8y+vcUdw1/au85alxquWMu9WZTGSC9Nd5bU=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=Hv5KQLQ2UwLZXPr3d4NXReb2U0SJwO+LFVJo2GWwniuztxszng+pTNo2o3uycl5XS8 GPUlWH3dAS0perTtnJMJXeN69BLPoncPLfwV79EMd3ye3JEVsWSkRvVJvvrcP7TE4Mk3 eHb0rD1FmGMULO86Xp7YfJuORAQ57oN8UZ6izNYe7Yl1vzsANG++iAExjWD+dF2RJo8K WIq5t8BYmxTQvN9Q/GpHa7ovxNaAhXzRFB3MIWohxkmPCx1xi2rCA/vjXrynKXeOCELL rM/8MvJrpktHvwtWLUpxSqAjAC2BDNDVsIy1yoKMb7C4631iJtJ5On1iqj237C3thgCf qCGw== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id i8-20020a635408000000b00573ffd25b44si4092628pgb.182.2023.10.13.01.58.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:58:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 44C8882B90E2; Fri, 13 Oct 2023 01:58:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbjJMI6e (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230258AbjJMI60 (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 4CA7A95 for ; Fri, 13 Oct 2023 01:58:25 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L0f4bp5zLqP4; Fri, 13 Oct 2023 16:54:26 +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:23 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 04/19] mm: huge_memory: use folio_last_cpupid() in do_huge_pmd_numa_page() Date: Fri, 13 Oct 2023 16:55:48 +0800 Message-ID: <20231013085603.1227349-5-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:58:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630109676666308 X-GMAIL-MSGID: 1779630109676666308 Convert to use folio_last_cpupid() in do_huge_pmd_numa_page(). Signed-off-by: Kefeng Wang --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index c9cbcbf6697e..f9571bf92603 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1562,7 +1562,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) * to record page access time. So use default value. */ if (node_is_toptier(nid)) - last_cpupid = page_cpupid_last(&folio->page); + last_cpupid = folio_last_cpupid(folio); target_nid = numa_migrate_prep(folio, vma, haddr, nid, &flags); if (target_nid == NUMA_NO_NODE) { folio_put(folio); From patchwork Fri Oct 13 08:55:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751676vqb; Fri, 13 Oct 2023 01:59:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXYrALdHKYtmhtoSSZDfQqE+WpRomY20Ez33Db1WDqN+gpGrcc/+/UBjrB7Q/3Wxl0N0U3 X-Received: by 2002:a05:6359:203:b0:15b:73a6:3ce8 with SMTP id ej3-20020a056359020300b0015b73a63ce8mr24045236rwb.2.1697187548090; Fri, 13 Oct 2023 01:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187548; cv=none; d=google.com; s=arc-20160816; b=VFlMIpXODpBAurcnj9oYrtyd6n5cnYNdvGk3NcuT8vWjO85J/TEgEYLyBdvg1Xb31R nZN52Mj3YFjs/Ud/I1FB8ne2trvTQnnlH0wO3DwsrKGYaiBI/TloJnk1at0BBSKqm3gf wHAV63zh1buq7aSUb8/lqnABgNVEBMoXa0fhbBLWhmsfgDIgocSlzDvhDnDY7jNQtChv 3gjLkmLcMvq+hsS/RDqzbe/hBYbvk1lTyLN3AzsWsWKm1jrAJzx2mlCYMXPGrpo0SMpv a9Pxr9xMwtqvAfdpwEqw1ajN/9ddZG6/7PPil9vjtYoex4F3Had/JihZFCllNuKoMblB 2zqw== 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=0YHxzJua+p5mlcs/k2mq03WYuq2lzIWkVKq0L7/b+fw=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=W4MkxQs0Kh3GPHH3keOXrjmaj46y8eLcXMF2jgSfXi6nI7enh9LE9wKXRV8DyHhhwU ALPEJgEcWjG5uoWMPKSCo83432wKqVIzJrarVPuU9+hEO0xS+0FHFwrV+UEWb5jUE/nh nP2msTj0NBi1nzNYH92ppVT0Bfd/w2hucy53XY0CazvPkMMcfPhA2xONmHDS2/q4Jy/z kb+/hHULVJ7DDQzY9BvvtouKMkmvOyLqyoqmv1+N2SjkH8fpgbtP4Lh8hDWK3uYTsF19 /lR3A98LjQJkWZQhSsF7D2zsvPMpgiCaY/lJUCIpo2ZCcUwXuntJP0l4xuQ87bhvbn4k TNOQ== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id p21-20020a635b15000000b0057884435a71si3957366pgb.396.2023.10.13.01.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 365F982B90E8; Fri, 13 Oct 2023 01:59:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230458AbjJMI6o (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbjJMI6b (ORCPT ); Fri, 13 Oct 2023 04:58:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5815C2 for ; Fri, 13 Oct 2023 01:58:25 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6Kzs0xdxzvPxp; Fri, 13 Oct 2023 16:53:45 +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:23 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 05/19] mm: huge_memory: use folio_last_cpupid() in __split_huge_page_tail() Date: Fri, 13 Oct 2023 16:55:49 +0800 Message-ID: <20231013085603.1227349-6-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:04 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630130046849045 X-GMAIL-MSGID: 1779630130046849045 Convert to use folio_last_cpupid() in __split_huge_page_tail(). Signed-off-by: Kefeng Wang --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f9571bf92603..5455dfe4c3c7 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2514,7 +2514,7 @@ static void __split_huge_page_tail(struct folio *folio, int tail, if (page_is_idle(head)) set_page_idle(page_tail); - page_cpupid_xchg_last(page_tail, page_cpupid_last(head)); + page_cpupid_xchg_last(page_tail, folio_last_cpupid(folio)); /* * always add to the tail because some iterators expect new From patchwork Fri Oct 13 08:55:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751767vqb; Fri, 13 Oct 2023 01:59:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+xEKS0LDh/m380tj3/yk7ghvY4MR2cxe8a3FqxBoLrReo4YasEsQ5zJgNrpIOr4qVnzyq X-Received: by 2002:a17:90a:4ca4:b0:274:99ed:a80c with SMTP id k33-20020a17090a4ca400b0027499eda80cmr23840338pjh.3.1697187562714; Fri, 13 Oct 2023 01:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187562; cv=none; d=google.com; s=arc-20160816; b=CTAiRZ+cj71O4gbuR/+gNC+b9P+xsaeGsXOmB1LFp5lVEBXcTwxXytfttfu7wa6evJ AZhXbeLEl8lsVq0NJDYPmFUw83A821vd/pt8HqKD5KoIrv895aRrWFYL3eGQDnW90GOU ufCn+sChpoz9ZW6p9yQ1/ZmpbJ4+Mr68b5IuzL2PqFa6D15c9cN/yVXRBJF1guWRh8UC F4CdWv34Tna4qRsiSO7ndXCuiRdrEk4fyKzufK1wLkElfLs7foQXcvhYia3UfFkPc54o wXF+MGp+pqfFztI+7ZwhPL1ES6lSRveBkGuf5WQCMhwu1uAtvL48npvNmPgOe6Zjq9u1 FpRg== 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=Ew90GRduGLuwlGQ2gfJPl9ppfNJrebvIabpuV6V4jCE=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=vsDzTiAZqekomiAa3+kf4HuYDFDRf/SvW7g6+NlGPfKR377WwzXQjBG2WrhjoMFYsH Ivhum98wlofbQ0tL+t/IZ2kWhUssVqTrNZOTU/5fPBtT42pHNEullEBft0nmY8ewzYBF iqnAQgMmhp8QrB4j7FUoFQJV3Bb3NEiKF46CM+u38G6iQyYOd3eHq8weOKe6liNRz8Nm POvVWeJiygwPSAJ4Be/McCoA0hI9T/WtwzD8wwiBIcdgF+1jAtbANPBhKPWq3fGKPcu+ +Jpoc0Kx+AZWMnfpJGnO985dhbZrOyuCVC3bF9At4/GCbgrlu+6BPISvaBw701y4hLda fx2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id p20-20020a17090ad31400b002773d013d02si4108506pju.140.2023.10.13.01.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id E907B82CC466; Fri, 13 Oct 2023 01:59:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230367AbjJMI6v (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230327AbjJMI6b (ORCPT ); Fri, 13 Oct 2023 04:58:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64B54B7 for ; Fri, 13 Oct 2023 01:58:26 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6L2D0JD9zrTQV; Fri, 13 Oct 2023 16:55:48 +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:24 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 06/19] mm: remove page_cpupid_last() Date: Fri, 13 Oct 2023 16:55:50 +0800 Message-ID: <20231013085603.1227349-7-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630145532727762 X-GMAIL-MSGID: 1779630145532727762 Since all calls use folio_last_cpupid(), remove page_cpupid_last(). Signed-off-by: Kefeng Wang --- include/linux/mm.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1c393a72037b..1d56a818b212 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1700,18 +1700,18 @@ static inline int page_cpupid_xchg_last(struct page *page, int cpupid) return xchg(&page->_last_cpupid, cpupid & LAST_CPUPID_MASK); } -static inline int page_cpupid_last(struct page *page) +static inline int folio_last_cpupid(struct folio *folio) { - return page->_last_cpupid; + return folio->_last_cpupid; } static inline void page_cpupid_reset_last(struct page *page) { page->_last_cpupid = -1 & LAST_CPUPID_MASK; } #else -static inline int page_cpupid_last(struct page *page) +static inline int folio_last_cpupid(struct folio *folio) { - return (page->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK; + return (folio->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK; } extern int page_cpupid_xchg_last(struct page *page, int cpupid); @@ -1750,9 +1750,9 @@ static inline int xchg_page_access_time(struct page *page, int time) return 0; } -static inline int page_cpupid_last(struct page *page) +static inline int folio_last_cpupid(struct folio *folio) { - return page_to_nid(page); /* XXX */ + return folio_nid(folio); /* XXX */ } static inline int cpupid_to_nid(int cpupid) @@ -1794,11 +1794,6 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ -static inline int folio_last_cpupid(struct folio *folio) -{ - return page_cpupid_last(&folio->page); -} - #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) /* From patchwork Fri Oct 13 08:55:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751625vqb; Fri, 13 Oct 2023 01:59:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhTtGAgqIA+vGP0uMjGYzxbVwwUks3P5U5Wx1ul5Qnr7feTUBsT/42DZEF4QQ7mO6lIPSS X-Received: by 2002:a17:902:d2c7:b0:1c6:2b3d:d918 with SMTP id n7-20020a170902d2c700b001c62b3dd918mr29572553plc.3.1697187541880; Fri, 13 Oct 2023 01:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187541; cv=none; d=google.com; s=arc-20160816; b=TWOgCmkmhxMcZ33SCYk5NfIGAt2qscJz083BF6uYO3kFic9nDCBLJeCdx+fC8pTEgS 9EFIqKU+rlU7Bu8cAhi2TI8EhgTOqXP6SGGdonNUvwLqKI2v4ZfCAe0kMxkL1bivNfNR nHmiySAFWVcQi2YePRuZJm3vTt8IPJ/mVTRUMg/uVjyXXdSpigS1DtIwJFTl4eI60IfT sPjcF7wmyP4RaiBXt8dbp2TuBu+lO1cKBhc7Xem4HV4YNXlvXk3VgUJa91ylLZUWCYV5 65ayGLoQYPCT+2AY9JOXob/jpinEDqWFukyHvxAL0SrQX8CdkEHK9E/nnBUznibbsdTs K/Gw== 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=MKSp5EBF6+Ov7gSZHW50N+nAf20gVCjFGTQvZhuqW6o=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=uLkOgenAoJdO+Qqxz1Pb9u9IDU1pTVc9pRnZUeBoEFTB1iMGSpk47U2FbTF1cLMCwK Fbph8swtBs7/kMe0GGjjBQp83VxMsig3tj096p0cv+VHimARKXThulne/GV5jt1VOlEr APolQ6QpUgfm2pwnccaPJogcLZ3wp90rDNVoNtdPA65CMes7GkNDL4AjhffLXWuchWFE jmm8vJYhVIiR1LJSFSfsWgR9hB5H0ZMCW5rMWcOuwyk4UfZN8onJiq75YHAUshBdn+rN B/gX2socmpSn0/xyqVmxDwrqmtJ+xllY9x8RauYSJtCbX5oLDxGW0y6ZLeMBazQNXNoM xnIA== 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:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id y10-20020a1709027c8a00b001c3671d3151si3835336pll.92.2023.10.13.01.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id ECF4382C5176; Fri, 13 Oct 2023 01:58:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbjJMI6j (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbjJMI62 (ORCPT ); Fri, 13 Oct 2023 04:58:28 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02DE395 for ; Fri, 13 Oct 2023 01:58:27 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4S6L0d3JBcz1kv2B; 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:24 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 07/19] mm: add folio_xchg_access_time() Date: Fri, 13 Oct 2023 16:55:51 +0800 Message-ID: <20231013085603.1227349-8-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630123545308076 X-GMAIL-MSGID: 1779630123545308076 Add folio_xchg_access_time() wrapper, which is required to convert xchg_page_access_time() to folio vertion later in the series. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1d56a818b212..1238ab784d8b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1794,6 +1794,11 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ +static inline int folio_xchg_access_time(struct folio *folio, int time) +{ + return xchg_page_access_time(&folio->page, time); +} + #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) /* From patchwork Fri Oct 13 08:55:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751809vqb; Fri, 13 Oct 2023 01:59:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpLI8nbT+QwQzrt6rFemDs3nRppvD3SFc24YbPVjIRiowMW5dNtPTG6qXBsuxNPsJxH5SA X-Received: by 2002:a17:90a:3da1:b0:274:60c7:e15a with SMTP id i30-20020a17090a3da100b0027460c7e15amr23796501pjc.4.1697187569367; Fri, 13 Oct 2023 01:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187569; cv=none; d=google.com; s=arc-20160816; b=XXKGPHKMiE7jSyTUZyC77drOLssLNfhACN0P2HO/wucabkApfsZTB3Fp0MOlmfQduD x/R6qk/3sUl7ma7Sdw3L30ds71lH28ST7d2yfgxCLM9H+OQ/RwP0gqD10/SMdPf+h5Af SbU9CgNfF4TEMgy4EIu/0+vbBuvkuBddACuEiIEdHAWT0WvfIKURFcKwRW3erpyy/5IU WPi9SJG29QIuxgFCVq/Jg+NQmBnBGQ7Mjt+U/zWxL0dpT45CmQZUnpV3Sh/TbWC/S/ZE yTfXgeI+xDbUVvcMTawn5kSP9bKorELoWm5HTl6TEEwATUFCdNL6wjOXfG/XF8T9vGXd HT5g== 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=1zLpUnjpBvurR96XU6U560Rf31eHqGYds42Z0gS0iKo=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=S5kNzBXPEEDMYLonRn3Q19/15zdctPX1Pm8W4cHz7bkCb4BB1FK3jYVNoQ/J+O6NIo +bmzq2EqVcfvm6XDwbM/Aofdife77ROvqX7Qmgd5Z72wm+ZeOK4uQjZVEfgEKDO9s58s D20ONWRJaCYwXLfdTbV7KEZ6TIVKA0qeIcQ/gm46r9mZz3g5d1+/kkPAMMzcRTsJ3glY 1k0N6JgEw8BosmAbnPnxNVeOZ2+CG8AGLhXhPxNuiebzcyApULMW6xmn4yRpX+aNf+Ho +8NlwpaR8TDu1bgbfPGkaxa/CmgVDEbngHwhyMZv+I6P2LEcWHOhoHZuCuarGWrWGPsi Tx1A== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id n11-20020a17090ac68b00b002790b1320d4si4080594pjt.84.2023.10.13.01.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 4B8B482B90F3; Fri, 13 Oct 2023 01:59:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230327AbjJMI7I (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbjJMI6b (ORCPT ); Fri, 13 Oct 2023 04:58:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71BCDCE for ; Fri, 13 Oct 2023 01:58:30 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6Kzx4wvpzvQ2w; Fri, 13 Oct 2023 16:53:49 +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:25 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 08/19] sched/fair: use folio_xchg_access_time() in numa_hint_fault_latency() Date: Fri, 13 Oct 2023 16:55:52 +0800 Message-ID: <20231013085603.1227349-9-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630152980369289 X-GMAIL-MSGID: 1779630152980369289 Convert to use folio_xchg_access_time() in numa_hint_fault_latency(). Signed-off-by: Kefeng Wang --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 78ad23fcb7f9..bc07f29a4a42 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1766,7 +1766,7 @@ static int numa_hint_fault_latency(struct folio *folio) int last_time, time; time = jiffies_to_msecs(jiffies); - last_time = xchg_page_access_time(&folio->page, time); + last_time = folio_xchg_access_time(folio, time); return (time - last_time) & PAGE_ACCESS_TIME_MASK; } From patchwork Fri Oct 13 08:55:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751667vqb; Fri, 13 Oct 2023 01:59:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnZTCYhU5U2TUQ4pGR1bYYJdRjCUvb97x1FPIKDhZ5U4lVyekZ1my9dOEF8VUdXLI6dYYh X-Received: by 2002:a17:90a:1:b0:27d:1f88:3cd with SMTP id 1-20020a17090a000100b0027d1f8803cdmr4174567pja.4.1697187546937; Fri, 13 Oct 2023 01:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187546; cv=none; d=google.com; s=arc-20160816; b=ZeiYQf/V9sXo9jhTsduCNohsdhbpIX5ZkiR0e5dlNU+x/yYtAcVVpSAhe6eE+vEX3V +aiI+z0zKuIEnehx8zFg7wAwA4mwLRMOfbzcSgQw6Hl4kt+PGrbF8xZAvEecJxDJGh7X qhaeIzXm6XbsNqnc9UUrF2iiWCZRf8UFD3To7nfnmT5taZbU11jephrqadbPJ1Zs3I4T e6zmXlpahWg6Z1N8vMtdRt9yJAuaVPq36oO5vAGH1FS4RAKj0VisppgndSjY9s7GTzu8 RqCEwLy5UlQY4MJuOg5eQiqtpYs05+zTTW+V/yIjqTxIxpxieIW2Bx2qLVBF54LEdaml KXHg== 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=M5rq17p38CIoi/oLZwLhZN5sMfFvqUf+eMJ9W4f1uNU=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=ixC7kqbz1baVtdrDgH+t57iD3QGb2J1Yxu7z+wx3e2c1zdDgqodU76idfBmmcTRZAF vZXFfwff0sxx4Veo0wr10wwUqdlX4T33Gr50YXI4CjZNWLcE674aXlgTYJ+gCtBNW/ob nTy8E8y2w2bvyIKrZjShaXq6zRtP7R7LUYUyaVAVyBHOasS3dhKEetoLAmVCSD3q+90c w99i/l99t/LblJnsBUYe0IjHzIjdYPkDU5k9Cc5e/jY7Y9Aacaf9wq5oD60QMpvV9vWk i5O3/E8TVJyKzp8TmB1+TBFqwHz6ChMyuc+4g0oM6Zo7UKLyN5jepdvBUDCoq2ne5Y2g QeSw== 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 nv10-20020a17090b1b4a00b0026305080a6fsi4571459pjb.63.2023.10.13.01.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:06 -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 45A9A82F08FD; Fri, 13 Oct 2023 01:59:06 -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 S231174AbjJMI6z (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbjJMI6a (ORCPT ); Fri, 13 Oct 2023 04:58:30 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DB995 for ; Fri, 13 Oct 2023 01:58:28 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S6L2G3p2Lz15NSb; Fri, 13 Oct 2023 16:55:50 +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:26 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 09/19] mm: mprotect: use a folio in change_pte_range() Date: Fri, 13 Oct 2023 16:55:53 +0800 Message-ID: <20231013085603.1227349-10-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:59:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630129306756714 X-GMAIL-MSGID: 1779630129306756714 Use a folio in change_pte_range() to save three compound_head() calls. Signed-off-by: Kefeng Wang --- mm/mprotect.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mm/mprotect.c b/mm/mprotect.c index f1dc8f8c84ef..81991102f785 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -114,7 +114,7 @@ static long change_pte_range(struct mmu_gather *tlb, * pages. See similar comment in change_huge_pmd. */ if (prot_numa) { - struct page *page; + struct folio *folio; int nid; bool toptier; @@ -122,13 +122,14 @@ static long change_pte_range(struct mmu_gather *tlb, if (pte_protnone(oldpte)) continue; - page = vm_normal_page(vma, addr, oldpte); - if (!page || is_zone_device_page(page) || PageKsm(page)) + folio = vm_normal_folio(vma, addr, oldpte); + if (!folio || folio_is_zone_device(folio) || + folio_test_ksm(folio)) continue; /* Also skip shared copy-on-write pages */ if (is_cow_mapping(vma->vm_flags) && - page_count(page) != 1) + folio_ref_count(folio) != 1) continue; /* @@ -136,14 +137,15 @@ static long change_pte_range(struct mmu_gather *tlb, * it cannot move them all from MIGRATE_ASYNC * context. */ - if (page_is_file_lru(page) && PageDirty(page)) + if (folio_is_file_lru(folio) && + folio_test_dirty(folio)) continue; /* * Don't mess with PTEs if page is already on the node * a single-threaded process is running on. */ - nid = page_to_nid(page); + nid = folio_nid(folio); if (target_node == nid) continue; toptier = node_is_toptier(nid); @@ -157,7 +159,7 @@ static long change_pte_range(struct mmu_gather *tlb, continue; if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING && !toptier) - xchg_page_access_time(page, + folio_xchg_access_time(folio, jiffies_to_msecs(jiffies)); } From patchwork Fri Oct 13 08:55:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751731vqb; Fri, 13 Oct 2023 01:59:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGx9DwEcFO3iTQjOD7cxy+qV8AxzVJKYwUIsCjAqTGpUsAjFhNlfRqEu3anJViPN9ahuj5y X-Received: by 2002:a17:90b:1d87:b0:27d:2261:73e4 with SMTP id pf7-20020a17090b1d8700b0027d226173e4mr3593360pjb.2.1697187556680; Fri, 13 Oct 2023 01:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187556; cv=none; d=google.com; s=arc-20160816; b=AayYEBtTI9xiFiZl9nOthAs07FcQ0T4CDhXl69Ag481/wUpwzFC5quJwedW380c2Q5 or0WGXBQ1sgplznNEa4ocNiIQSyXCh6ysxwWfU39JBdazyO9ac2GtXEFOJjl6ZEowQH3 VjJPZPIX11AQoR75qiYHYaqQ5yZADnbaTmeaqhkAz8gk7TPlTOTjzNKrzZpholBDBNcq r0xT27Lzne4PDRihHRrpPHabJh5h4Q/MRp+gOgbdGtf1vWbIt8fO/gVhgflaeEj2C45v VLjAUEoqCVJiUlOQOG91cGmififb6laLIxWkq/iS2TDEm6BWCCij5C8lHX9iUMw5Wdj3 XobQ== 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=ms2pbGLo7mG2bKDY2JPOUHEMK8SMoQKLkUCNA44AIfg=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=Hw7wy6ElgZmkObaVmjYErHzs/IHM/bRedLdUuv7v1Gnk4RaNeOTgajGOX68+pumeml kXE0o/fxlIV1dMYIRKD2tjoGPnWh9jPLjBCFHRLVmAQfPVCnr8uxJ3Syl4+acolT2+t8 8b2OZKMcpypPu1A/Xo9fmMLyhEryv5lBDzWHzJRc3hOvxy9lYsS6A20hm/HSypEbgHsq TSOLnRYZtgTJp+AomLequ5wsS3b4rvXi3snQqQQLokdjX9NGKX6ci/i5ga2cYKTazrDZ /YIGYvtfrxj6zAyVhOBWECRpLbATZETXALmapSiCZGzzQGulWhOi58Dvq6j4a5Wyx9Uk 0p5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id j19-20020a17090a841300b002790c6760dbsi3962346pjn.70.2023.10.13.01.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 8A00182B90EE; Fri, 13 Oct 2023 01:59:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231278AbjJMI66 (ORCPT + 19 others); Fri, 13 Oct 2023 04:58:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbjJMI6b (ORCPT ); Fri, 13 Oct 2023 04:58:31 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5FB1B8 for ; Fri, 13 Oct 2023 01:58:28 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L0k0jsvzLqSx; Fri, 13 Oct 2023 16:54:30 +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:26 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 10/19] mm: huge_memory: use a folio in change_huge_pmd() Date: Fri, 13 Oct 2023 16:55:54 +0800 Message-ID: <20231013085603.1227349-11-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630139492067620 X-GMAIL-MSGID: 1779630139492067620 Use a folio in change_huge_pmd(), which helps to remove last xchg_page_access_time() caller. Signed-off-by: Kefeng Wang --- mm/huge_memory.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 5455dfe4c3c7..f01f345141da 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1856,7 +1856,7 @@ int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION if (is_swap_pmd(*pmd)) { swp_entry_t entry = pmd_to_swp_entry(*pmd); - struct page *page = pfn_swap_entry_to_page(entry); + struct folio *folio = page_folio(pfn_swap_entry_to_page(entry)); pmd_t newpmd; VM_BUG_ON(!is_pmd_migration_entry(*pmd)); @@ -1865,7 +1865,7 @@ int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, * A protection check is difficult so * just be safe and disable write */ - if (PageAnon(page)) + if (folio_test_anon(folio)) entry = make_readable_exclusive_migration_entry(swp_offset(entry)); else entry = make_readable_migration_entry(swp_offset(entry)); @@ -1887,7 +1887,7 @@ int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, #endif if (prot_numa) { - struct page *page; + struct folio *folio; bool toptier; /* * Avoid trapping faults against the zero page. The read-only @@ -1900,8 +1900,8 @@ int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, if (pmd_protnone(*pmd)) goto unlock; - page = pmd_page(*pmd); - toptier = node_is_toptier(page_to_nid(page)); + folio = page_folio(pmd_page(*pmd)); + toptier = node_is_toptier(folio_nid(folio)); /* * Skip scanning top tier node if normal numa * balancing is disabled @@ -1912,7 +1912,8 @@ int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING && !toptier) - xchg_page_access_time(page, jiffies_to_msecs(jiffies)); + folio_xchg_access_time(folio, + jiffies_to_msecs(jiffies)); } /* * In case prot_numa, we are under mmap_read_lock(mm). It's critical From patchwork Fri Oct 13 08:55:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751818vqb; Fri, 13 Oct 2023 01:59:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLXjh5L06JEbO4FFPeq7VYVL0+mYIGSZ9DIQblzpiqOAfLWx6xvjPyC3vZqpAqPD+gzzg+ X-Received: by 2002:a05:6a21:a5a0:b0:15d:a247:d20c with SMTP id gd32-20020a056a21a5a000b0015da247d20cmr34349295pzc.6.1697187570253; Fri, 13 Oct 2023 01:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187570; cv=none; d=google.com; s=arc-20160816; b=PVI89BQ2ZrxAOawEKjwKAJ8l7i7hijwA1gbeOv2j9leipYIxJczB/rGClrpr5qP3ZD tpFl/w2L1hcxf7o9b2tAY3k25IpZl3dTS2qgzc+LeCApT1SRN8heVeynGftNzlEcMRd9 082hNIvwIHOZS6bQ5C2JE7WHV/JrzwKnsgIFv8yx+75MLvipGPApT+VkSi15YofRiDW3 Ux11afZUz3pNlj6ShHF+TZZOLL2AONEaCXcTrJR9n7bjwTr+TNl8WoiRTYz3E3u+yA2m nMc/1eE8I2mIAiA4yQwBRv+En0VW1kZfJ9E0K5RRT/GcfA+9mS1WcY/x9LsThyClLian b4Yg== 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=dav5PI7iEms8jeP4a1XhSbNqrplMPXmJIKIe/iyLzYk=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=j0k1xipVHClnIc1CWoeOLOVnxDwf8qdIgTBBB/9LlIg1vRWoOCakqY4K+j2Ud2Ndi7 up3KyYndJ1SVkFBHgr32F7bzRcXZL2OavNOrrJbSwbLJkHQRLhu4ZK1+HwaFWrPCbyZL +8OsX2zHXZIwyd02SPhLeuByBRjmyHWR2t4ETY4OvlbEuCfYZY74OfrQyKmk+vIQC5Mx lvZM0rpiYx7qEQpZOx7VKLDzQQITfBiBTJ7oDDEukSbzlxLGyJvwL5ka0JCyKfz3iJCJ 1cjCUlbZqcq9FhvvfdAJKIDPoHppLrbsN/Vxl+O/ZLff8kLecQcP3+HpA3uUyuASRAMC wLig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id z7-20020a170903018700b001bb8df95094si4329078plg.509.2023.10.13.01.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 9EB40839D9EF; Fri, 13 Oct 2023 01:59:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230223AbjJMI7L (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbjJMI6d (ORCPT ); Fri, 13 Oct 2023 04:58:33 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B54F6D7 for ; Fri, 13 Oct 2023 01:58:30 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6Kzx5jsFzvQ3m; Fri, 13 Oct 2023 16:53:49 +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:27 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 11/19] mm: remove xchg_page_access_time() Date: Fri, 13 Oct 2023 16:55:55 +0800 Message-ID: <20231013085603.1227349-12-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630153734096186 X-GMAIL-MSGID: 1779630153734096186 Since all calls use folio_xchg_access_time(), remove xchg_page_access_time(). Signed-off-by: Kefeng Wang --- include/linux/mm.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1238ab784d8b..8a2ff345338b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1722,11 +1722,12 @@ static inline void page_cpupid_reset_last(struct page *page) } #endif /* LAST_CPUPID_NOT_IN_PAGE_FLAGS */ -static inline int xchg_page_access_time(struct page *page, int time) +static inline int folio_xchg_access_time(struct folio *folio, int time) { int last_time; - last_time = page_cpupid_xchg_last(page, time >> PAGE_ACCESS_TIME_BUCKETS); + last_time = page_cpupid_xchg_last(&folio->page, + time >> PAGE_ACCESS_TIME_BUCKETS); return last_time << PAGE_ACCESS_TIME_BUCKETS; } @@ -1745,7 +1746,7 @@ static inline int page_cpupid_xchg_last(struct page *page, int cpupid) return page_to_nid(page); /* XXX */ } -static inline int xchg_page_access_time(struct page *page, int time) +static inline int folio_xchg_access_time(struct folio *folio, int time) { return 0; } @@ -1794,11 +1795,6 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ -static inline int folio_xchg_access_time(struct folio *folio, int time) -{ - return xchg_page_access_time(&folio->page, time); -} - #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) /* From patchwork Fri Oct 13 08:55:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751887vqb; Fri, 13 Oct 2023 01:59:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFcZQJ+vqly3/dYgTwuyUj7QiIrNGajxqA4+GDs9rMC4NwSnxPKkOHKv0fst84c2MJXlSU X-Received: by 2002:a05:6358:e908:b0:147:47f2:2d54 with SMTP id gk8-20020a056358e90800b0014747f22d54mr22870276rwb.0.1697187580893; Fri, 13 Oct 2023 01:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187580; cv=none; d=google.com; s=arc-20160816; b=0BUi0uhIANp/D2bxCdlaEPOrUkBTLZkm5KSf5HjtR76o1zZDFqkwFvGEswl2rA2i3u z3fdT75lCYic3NFjfNDvKTjUZgUPR0T8VBFwFjBdduB9ipq0u/C0zbrTsz+aihFbxxIW OfO7jV2KFxSwS9Gy0KCeoA+44UpPyR9HvvmP7CzsK5VI4brQ6kVNF+55Ohke5dRPmIRV cEWkYAbeZ0jY3V6lq6IlR8hx6RO27o+/UIwYR/UXfbq++FsAQq7fQWPfHQqw2XRHLtKk M3r3KlrTlU/bgaJE7lHJfIG1fETTXNR/8yk/9GnflRVSmFwZBbsah44RQLSMSQa7axoq soKg== 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=DNlrD185RwWjuMxj0G5WMekXxP2MZsx6AcQ/7SuQlaE=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=YAgVFDk9fV7yW8vOAa0AvFuJNUfx51ismDa6C0byRV6oUjXf3OI3jWJd4fRlegeuEU LGYSVYelz1cwJUucl5SrUD4iennfIWrKlT6zqWEw8jaXmkj0zknuOD/Z7el01SjvNhZu V6gEJRgQQMPiGgE4bSVZoxji4LDUxqSoqwtw08TanElpn2kz5CMN0UGCaoMmZmdHBkuF yK/ArXpjCPdp6i36p+BdAYyTOzQKGfLzA0mXTem+EFAN+EqzKPJOWtNK3tGeuw0nWaYb +UMOqKlZH+S7JOJ/aLFtLw4dxfQvXo/yhQ3x1UbMT00qLu0kwqsNGcVVsRMYwwKIx8T8 T+0A== 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:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u190-20020a6385c7000000b005ace065e52dsi397898pgd.369.2023.10.13.01.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 7CA4681B5D0F; Fri, 13 Oct 2023 01:59:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbjJMI7B (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbjJMI6b (ORCPT ); Fri, 13 Oct 2023 04:58:31 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC8C0C0 for ; Fri, 13 Oct 2023 01:58:29 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L0l1jcqzLqXJ; Fri, 13 Oct 2023 16:54:31 +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:27 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 12/19] mm: add folio_xchg_last_cpupid() Date: Fri, 13 Oct 2023 16:55:56 +0800 Message-ID: <20231013085603.1227349-13-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630164571313063 X-GMAIL-MSGID: 1779630164571313063 Add folio_xchg_last_cpupid() wrapper, which is required to convert page_cpupid_xchg_last() to folio vertion later in the series. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 8a2ff345338b..8229137e093b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1795,6 +1795,11 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ +static inline int folio_xchg_last_cpupid(struct folio *folio, int cpupid) +{ + return page_cpupid_xchg_last(&folio->page, cpupid); +} + #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) /* From patchwork Fri Oct 13 08:55:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751780vqb; Fri, 13 Oct 2023 01:59:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnMSHJ/ekKmAdNU84DSth2EYz7IqvR/PdFmfTjZKqkTQ1nuRoa11pA7XZrba9LZ/X481PP X-Received: by 2002:a05:6e02:9a:b0:357:4682:d128 with SMTP id bc26-20020a056e02009a00b003574682d128mr7583782ilb.1.1697187564286; Fri, 13 Oct 2023 01:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187564; cv=none; d=google.com; s=arc-20160816; b=FsZP3c30CBkunLuDAIV69I2/GfXMW5La0U6J1boRJoKs4EBXwRUxDGMF8gWj6b6sgY df7/FncGk4YGEx4DwU7tkjRanBriHRdmPrUZW9cfyJCjf5NYnyPApcU95MZYxOAzFMRv rSJ7fVYLMrOl96qedYdC+9Sy/WX/W+mNQz3AnZ5b6TzNPt1Rl4bLn/nbU6IdepY7SmyM 6rxxcHVpRV3yi94fzo9LpHkjl7HPOsedusi6jAH58ZHdbE9xuuu5CmI6b6R+QZ3KQXQg wU2BuwKNf17kUMP75LMKZwYz8wYh6pCyQwgqmIm+rUb6Uixq9bd8FgH067ph6SJF5G9F 904w== 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=0k79eWN2qPWQalXNVxOZ5DtGxynTd8wYPB9G+6CYZjA=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=jRWqQ3I5t/7tSoHV3u9+way4Pyukw0HgqM5ygQTfYUqF8GE5Ol/8V/d47lk7fKynqz tc1BhmaH3QNN76u0QIhVBeGno8Yo+EnUv3w6bVQmMl49gXiTbfHXugjBGyvjG87DBPD1 VPKMgoSsUVW2F+GNMB7sKTbZEDyYJ+u2+nLBw6GQXkiBzZwBwXYQ7YzuCybxlTkGRrLp k43JBMcaOea6lOqL/PjsmvQZER9WfTpNUxvEGLtzBAIySVtcv7qROvgK1e+454U/duKe 4Gu8qz6SsEDSsElNkvVxJYQZGDMDlFMc0VOw3NhGuOR0MsCIlNwkCSyZoaJpEzoFLjEY G3tQ== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id g126-20020a636b84000000b005655bf61e32si4050365pgc.23.2023.10.13.01.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 3F20882B90EC; Fri, 13 Oct 2023 01:59:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbjJMI7F (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbjJMI6b (ORCPT ); Fri, 13 Oct 2023 04:58:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FA64D6 for ; Fri, 13 Oct 2023 01:58:30 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6Kzx5LBgzvQ3X; Fri, 13 Oct 2023 16:53:49 +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:28 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 13/19] sched/fair: use folio_xchg_last_cpupid() in should_numa_migrate_memory() Date: Fri, 13 Oct 2023 16:55:57 +0800 Message-ID: <20231013085603.1227349-14-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630147511396089 X-GMAIL-MSGID: 1779630147511396089 Convert to use folio_xchg_last_cpupid() in should_numa_migrate_memory(). Signed-off-by: Kefeng Wang --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bc07f29a4a42..f3cb4c8974c5 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1862,7 +1862,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct folio *folio, } this_cpupid = cpu_pid_to_cpupid(dst_cpu, current->pid); - last_cpupid = page_cpupid_xchg_last(&folio->page, this_cpupid); + last_cpupid = folio_xchg_last_cpupid(folio, this_cpupid); if (!(sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) && !node_is_toptier(src_nid) && !cpupid_valid(last_cpupid)) From patchwork Fri Oct 13 08:55:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1753072vqb; Fri, 13 Oct 2023 02:01:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGT6gwnpYUUgijUgyzl2N11plPdmkqGbTmLS7Z8RXfAlZomne2mvG2uo4flcosAfySC43SP X-Received: by 2002:a05:6830:4902:b0:6b9:b987:1337 with SMTP id eq2-20020a056830490200b006b9b9871337mr31325156otb.1.1697187709066; Fri, 13 Oct 2023 02:01:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187709; cv=none; d=google.com; s=arc-20160816; b=tiS4fZgBuRF0Uk5yCL8I08FzWAb3+RDUiXxT/E5J6BP/1t4AXdPqPejKbjowJhbl1X dSvTAo4+TgvuFFAR9kuptPHzFuH9XmyyyWYi1BtpDe7z/ni4g+UJBoiE+aoYcI+aKBy+ +fzH79AOi7Sq48V79RAzAJcfURIeC4/iBzAK3/LuZw3fCbxXa8/l6O6TOEGXnjBNip0F PciBvRD/7yHwI6e2Vp7sLnRnndTBp0pLAszC0UpQG/farMtzN+2VEn1Z/A2FNkv2ljNU 64PEbDxwWs8XWtXWlMvvdTeYP0N2LGnJDrq+LvOr53COrp27h7XRqkh9BktJtnSAJLp7 Vg0g== 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=ONiFhuoJXZyIBus5P7d1IKd0msDLCi+tp53vVhwi8Pw=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=xyISXhOZdshV9CYdAzWXM331T9d4DfVO6F4iigk1CWjQt01T9sUD7GM2TdHNiGlu2c CJM9pS4QZTXi+LI9SXaB2ZJhRcw0URxkknW9qfgLdDIFbm1ixTViubfrMERFxRrohynd ZvrM7hV9Bkv0FpWGAmSqjvwVEcASql8POt1St1nndvNSirybv1I3iLdE+6EHapkkJ6zq aIHkDMIPrb4qhMQAxcSoCJtp+14rb+Z6vuJ+Z2yVMyu6HlFJ1SUotoVCJvpWUL9yPyjB wf4S84lBVuqHCB6n11kkoZUAKi2LkkunThF754U5o5nh4XVuUC0vyM9Fh6K5kLGx93p6 9S2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id g21-20020a056a001a1500b006b1fb740866si1353452pfv.189.2023.10.13.02.01.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:01:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 7458982CC46F; Fri, 13 Oct 2023 02:00:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbjJMI7O (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230357AbjJMI6d (ORCPT ); Fri, 13 Oct 2023 04:58:33 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0438AD8 for ; Fri, 13 Oct 2023 01:58:31 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6L2J4jVLzrTR9; Fri, 13 Oct 2023 16:55:52 +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:28 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 14/19] mm: migrate: use folio_xchg_last_cpupid() in folio_migrate_flags() Date: Fri, 13 Oct 2023 16:55:58 +0800 Message-ID: <20231013085603.1227349-15-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 13 Oct 2023 02:00:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630299251538076 X-GMAIL-MSGID: 1779630299251538076 Convert to use folio_xchg_last_cpupid() in folio_migrate_flags(), also directly use folio_nid() instead of page_to_nid(&folio->page). Signed-off-by: Kefeng Wang --- mm/migrate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 5348827bd958..821c42d61ed0 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -588,20 +588,20 @@ void folio_migrate_flags(struct folio *newfolio, struct folio *folio) * Copy NUMA information to the new page, to prevent over-eager * future migrations of this same page. */ - cpupid = page_cpupid_xchg_last(&folio->page, -1); + cpupid = folio_xchg_last_cpupid(folio, -1); /* * For memory tiering mode, when migrate between slow and fast * memory node, reset cpupid, because that is used to record * page access time in slow memory node. */ if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) { - bool f_toptier = node_is_toptier(page_to_nid(&folio->page)); - bool t_toptier = node_is_toptier(page_to_nid(&newfolio->page)); + bool f_toptier = node_is_toptier(folio_nid(folio)); + bool t_toptier = node_is_toptier(folio_nid(newfolio)); if (f_toptier != t_toptier) cpupid = -1; } - page_cpupid_xchg_last(&newfolio->page, cpupid); + folio_xchg_last_cpupid(newfolio, cpupid); folio_migrate_ksm(newfolio, folio); /* From patchwork Fri Oct 13 08:55:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751769vqb; Fri, 13 Oct 2023 01:59:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0WFjN9WUjNZnTrDKraEhwGkQQW3jLsb6F/JrvzGlyck7T3nAHgWSijCkVy6JAWPTq+h8/ X-Received: by 2002:a05:6a20:9393:b0:16c:b95c:6d38 with SMTP id x19-20020a056a20939300b0016cb95c6d38mr19197063pzh.2.1697187562876; Fri, 13 Oct 2023 01:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187562; cv=none; d=google.com; s=arc-20160816; b=n4jwNf2Nu2ox0UGaUL1RlJkpO07Huy+qF03WYervW/750/UCO9TwonSUjPBkdPDp55 wIkYgQue87YZn+h/5IwY7FNM8QggAX5o8RV/M0lT13CWJWRcRSRE2c8nrg1OcTDuMcDt WDPMPqljqml5qYbrgHZSQ6aOnFrnFXhiABEhEUNnr5gpWP4QbaO76Avo+xztd200Js9W vZFE51DDVnKx5Q128tQpdnuK933H6xgSsTe8G78tIO3eKnpvvgVMmgWJzn54BmyV9Q9N hx7bAvteVggDnh0i2DGs3joTDNxb6qNT004I/9GQcP+NKDuocyVcbp+vXlKQYbuxQoGn Zs1g== 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=J7hLCzxP+vfH5k3zHwo4He37UOBmYzrfi4mtBVqDm2w=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=w4W+q3pliYNs9KmlmCu1njQWGyt3yMmbUOxeQJ80u+K/9zoVxUdp0JSSjoHfQ2cmS5 KXIQoW12FWpkRpQ2lKeUXU9NEq85mKtkhUAejysWh9+na+8FKcxZ/OT/j0lsFd5hIrOt 712dmdWsI7WxYdb2x68qOj1Vtdg+1BWh/3uhc25VpBgMMy76pY+jo85a53zVrlHaHOsF kgn81zr0/OcLan5XaRlKnafoG1PK/AEdxpyYPfZNHScXVWbD/MeM257vxH5H2wo3bHrf WpBVI6frKgY9ZmlZIne+9nfOJp1kvUVqvwefIO8k4x4o8qhlDJaDzoSESVkdtIMGUvk4 I8jQ== 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 u9-20020a170902e80900b001c73732c1f2si4403496plg.223.2023.10.13.01.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:22 -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 34E7A82F27F0; Fri, 13 Oct 2023 01:59:22 -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 S230397AbjJMI7S (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230358AbjJMI6e (ORCPT ); Fri, 13 Oct 2023 04:58:34 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C83D95 for ; Fri, 13 Oct 2023 01:58:31 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L1F2x25zVlVS; Fri, 13 Oct 2023 16:54:57 +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:29 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 15/19] mm: huge_memory: use folio_xchg_last_cpupid() in __split_huge_page_tail() Date: Fri, 13 Oct 2023 16:55:59 +0800 Message-ID: <20231013085603.1227349-16-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:59:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630145720758252 X-GMAIL-MSGID: 1779630145720758252 Convert to use folio_xchg_last_cpupid() in __split_huge_page_tail(). Signed-off-by: Kefeng Wang --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f01f345141da..f31f02472396 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2515,7 +2515,7 @@ static void __split_huge_page_tail(struct folio *folio, int tail, if (page_is_idle(head)) set_page_idle(page_tail); - page_cpupid_xchg_last(page_tail, folio_last_cpupid(folio)); + folio_xchg_last_cpupid(new_folio, folio_last_cpupid(folio)); /* * always add to the tail because some iterators expect new From patchwork Fri Oct 13 08:56:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152423 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1752611vqb; Fri, 13 Oct 2023 02:01:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhsrg/ilzze+7pDgf/nMxEugAxT5Nc8KglEfF5I9netGboU8P8O62U0SoO8DCgqZ4REkUM X-Received: by 2002:a17:90b:1496:b0:27c:f88f:11a5 with SMTP id js22-20020a17090b149600b0027cf88f11a5mr8714865pjb.2.1697187662757; Fri, 13 Oct 2023 02:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187662; cv=none; d=google.com; s=arc-20160816; b=ZW9S73C+MCNVYA5Og6MzHyOjOvHWWktXAT7mVP0AjLbxxaJr33C9GKV571AJONC3vX Z5SYp0UsQrPn4osdnmFoXfcHqAN8kmwb4XCLRklVX2NcjRAE/GdWcy0ilk/9T4ZeVZP8 EhtooQ/K1Vrksl42zB8Q0vitv2BcQl0qo+UsbLkB0APYXuhC4XsUkgNWTHKxn8k1VNCU Ssfo6xil7jWzWyp2PLZpFl49DMtzqYFpEzO9sGmIkGHSLuE6sySRjPWNpjsK/Dhf5NW4 LJTuEsocyPqNfywcEqeZdXClCgk5G1TBmAzCqMgIcp9N9C7R3XGAqtcOtyorkghm5zZX BJnA== 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=MUSi80tZ4yNk8CECWcRvMJAQ5YmLm4C/rY6QQ6q7lE8=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=XplXH5uHp7Moq8kB3Apz5EiQOfHQxcHoK2q0rLSg5g9d2+PLnFZdGs7mIvuvEzdyoz sQKk8kx+x3znLB3+oaF3OtqYTYG454vbUatf8A1HLy4bzURLIRoK8QM8bbmyk1BPYmyK kE/bJJ1G/WecjTDDYJrmljHysuNbknznvU/JIq4AG4G7gIbox+ymQAi3KMy9ow5KrDRM dZaNOZfrPrvTDPxXFSwUNPz3Y9HYKnUKA/pggdC92WsLhpR8lM+ZHnQQvAMRm4Gvtrpa sZ2ol94mmplI2x06tu8QiS9UnbLYymfmtHdAx1MpzcyxMuAJjPF4MzppXyXbn7r1rbPz 7t6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id q15-20020a17090a68cf00b00263860e1f4csi4309917pjj.16.2023.10.13.02.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:01:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id A3BF08279A46; Fri, 13 Oct 2023 02:00:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbjJMI7V (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbjJMI6e (ORCPT ); Fri, 13 Oct 2023 04:58:34 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A341DD for ; Fri, 13 Oct 2023 01:58:32 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4S6L0k4qGFz1kv2n; Fri, 13 Oct 2023 16:54:30 +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:30 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 16/19] mm: make finish_mkwrite_fault() static Date: Fri, 13 Oct 2023 16:56:00 +0800 Message-ID: <20231013085603.1227349-17-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 13 Oct 2023 02:00:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630250560057267 X-GMAIL-MSGID: 1779630250560057267 Make finish_mkwrite_fault static since it is not used outside of memory.c. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 1 - mm/memory.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 8229137e093b..70eae2e7d5e5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1346,7 +1346,6 @@ void set_pte_range(struct vm_fault *vmf, struct folio *folio, struct page *page, unsigned int nr, unsigned long addr); vm_fault_t finish_fault(struct vm_fault *vmf); -vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf); #endif /* diff --git a/mm/memory.c b/mm/memory.c index a1cf25a3ff16..b6cc24257683 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3272,7 +3272,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) * Return: %0 on success, %VM_FAULT_NOPAGE when PTE got changed before * we acquired PTE lock. */ -vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf) +static vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf) { WARN_ON_ONCE(!(vmf->vma->vm_flags & VM_SHARED)); vmf->pte = pte_offset_map_lock(vmf->vma->vm_mm, vmf->pmd, vmf->address, From patchwork Fri Oct 13 08:56:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751982vqb; Fri, 13 Oct 2023 02:00:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHF3bFRNQMUQugT9HX8jTncaV7mPNg7WBDN2aSM+7AmE/Eyzd7LUxIpBeRU05zyjxzuBPz3 X-Received: by 2002:a17:902:ce86:b0:1c4:2b71:7dc9 with SMTP id f6-20020a170902ce8600b001c42b717dc9mr29432075plg.4.1697187599789; Fri, 13 Oct 2023 01:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187599; cv=none; d=google.com; s=arc-20160816; b=oIWqcnSP4Qw1OWMw0GnFRvhW3dNewKDIl776Jrf/Xm7A4H967E05g+TJA3obqKfDJj jL0h/1O7nFbOcF/M1pbmIur+ObeKpfIFqZ87z6g2G9Hd5SmbQvOlsf7n2sNHGep2wdjQ 9KuUkL+8e2I3u6vbCngVp/9yI5vY1Dl5wPofq+cpoBoCKyBa9Iooyvtb7cL+Lbl9mBBX i+AHeQcehHWZiKMzL3rINjTJwwCL3Ig3H5IIFUxkkcDiBPVLHR2KbwYAGcKZshhFr7Tt NexmC8GC5AfYwB2l3sye1rp8/aGA3fMr2k5cIJcPY4HA7eF+NQ/UZfOl7U0CdlhWl7gL mprg== 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=cXGe+ZxAMCbzmhr4nz4OXGUo6DR8hOC6Ngyljy3RdKg=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=Ah/mWXLAnWkhNFqvVN4hrhzuMcKUjUnwytQfMWxKG94+Nrxpx4F1vuvLjQCoAraovm yXlICdgCBYTJEranZS+zdSROqgfAJqJ4JIFB1BLjGhAxJkarvcL5oUu9dEbgjKV/iK3C A+ke94kZ+sox5QACM/so1np7+L214VpjNW/N2K0k799tbXusDTJQbpQT14AlIpR+BP6t m6DgFFjaadL5LmBiECmY434thO1mqLq/vG9T3ARW9TZSVRlO8VmiDf3JKHy7ogPcqnyW OSEBmWapRELYmB77PALdRiAlKcHx3Ic/57B2Yvo8Z41dJXrSqny7kSMNwerdVXYixT5H oaQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m14-20020a170902db0e00b001bc674914b0si4284884plx.472.2023.10.13.01.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id CCA6D82B90FC; Fri, 13 Oct 2023 01:59:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230433AbjJMI71 (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230356AbjJMI6f (ORCPT ); Fri, 13 Oct 2023 04:58:35 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C70FE4 for ; Fri, 13 Oct 2023 01:58:33 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L0p19gNzLqNj; Fri, 13 Oct 2023 16:54:34 +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:30 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 17/19] mm: convert wp_page_reuse() and finish_mkwrite_fault() to take a folio Date: Fri, 13 Oct 2023 16:56:01 +0800 Message-ID: <20231013085603.1227349-18-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630184635644177 X-GMAIL-MSGID: 1779630184635644177 Saves one compound_head() call, also in preparation for page_cpupid_xchg_last() conversion. Signed-off-by: Kefeng Wang --- mm/memory.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index b6cc24257683..6b58ceb0961f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3018,7 +3018,7 @@ static vm_fault_t fault_dirty_shared_page(struct vm_fault *vmf) * case, all we need to do here is to mark the page as writable and update * any related book-keeping. */ -static inline void wp_page_reuse(struct vm_fault *vmf) +static inline void wp_page_reuse(struct vm_fault *vmf, struct folio *folio) __releases(vmf->ptl) { struct vm_area_struct *vma = vmf->vma; @@ -3026,7 +3026,7 @@ static inline void wp_page_reuse(struct vm_fault *vmf) pte_t entry; VM_BUG_ON(!(vmf->flags & FAULT_FLAG_WRITE)); - VM_BUG_ON(page && PageAnon(page) && !PageAnonExclusive(page)); + VM_BUG_ON(folio && folio_test_anon(folio) && !PageAnonExclusive(page)); /* * Clear the pages cpupid information as the existing @@ -3272,7 +3272,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) * Return: %0 on success, %VM_FAULT_NOPAGE when PTE got changed before * we acquired PTE lock. */ -static vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf) +static vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf, struct folio *folio) { WARN_ON_ONCE(!(vmf->vma->vm_flags & VM_SHARED)); vmf->pte = pte_offset_map_lock(vmf->vma->vm_mm, vmf->pmd, vmf->address, @@ -3288,7 +3288,7 @@ static vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf) pte_unmap_unlock(vmf->pte, vmf->ptl); return VM_FAULT_NOPAGE; } - wp_page_reuse(vmf); + wp_page_reuse(vmf, folio); return 0; } @@ -3312,9 +3312,9 @@ static vm_fault_t wp_pfn_shared(struct vm_fault *vmf) ret = vma->vm_ops->pfn_mkwrite(vmf); if (ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE)) return ret; - return finish_mkwrite_fault(vmf); + return finish_mkwrite_fault(vmf, NULL); } - wp_page_reuse(vmf); + wp_page_reuse(vmf, NULL); return 0; } @@ -3342,14 +3342,14 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf, struct folio *folio) folio_put(folio); return tmp; } - tmp = finish_mkwrite_fault(vmf); + tmp = finish_mkwrite_fault(vmf, folio); if (unlikely(tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) { folio_unlock(folio); folio_put(folio); return tmp; } } else { - wp_page_reuse(vmf); + wp_page_reuse(vmf, folio); folio_lock(folio); } ret |= fault_dirty_shared_page(vmf); @@ -3494,7 +3494,7 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) pte_unmap_unlock(vmf->pte, vmf->ptl); return 0; } - wp_page_reuse(vmf); + wp_page_reuse(vmf, folio); return 0; } /* From patchwork Fri Oct 13 08:56:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751909vqb; Fri, 13 Oct 2023 01:59:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFp+88TiW0dXvmW8axuFd7tX8xeWGB7Xv9CGGYsLY7acvHS/7JYLK3XrdHHQG2HXcSMQ8Jh X-Received: by 2002:a05:6359:b9a:b0:14d:2dd5:a777 with SMTP id gf26-20020a0563590b9a00b0014d2dd5a777mr22749683rwb.2.1697187586301; Fri, 13 Oct 2023 01:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187586; cv=none; d=google.com; s=arc-20160816; b=QqIJE0AcK5uhlv5A3hTEX4d7UlDKFYmVLT0mHm0BlsVq25egRsNBN3zeoHxp3/6fft ixK3kJ7eP849gm03iIGDaei+kwUTfMuxoil+Z2Cx6TOnL96KJ+4f6aW1N8st8943KMEo A2P3emwu0qisbu+cKjenyQ+vWH6VQeOTnPyH4AEXPNFSIDx47ez8jhPZAnSu2lrBSE5a UObCIIu4BZOxKZNVG+LSwJ4FV2rQOWg41f2lfCmDM9frjW3cA1j2+3qgGy8BbxHXQncx svb9rcGR3fmWUzOwyQJsWERxEPghg+dk4FRk+v1TrOXef3s5CphkjVrIyHzAId7gsGOV QVhA== 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=73qbkeRYK0UwEo09b8YO/gA+ZBZX23AWTiCUsRN78/g=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=vmNpsg01WONmUWxg3gBykAdi1EOgafDsaWTHz//rGGdD4PwFgqnTWSAoWc17sboyR4 6mFgTEegiQDiSrUjB8zXddAWkrNIPbH0D1ZU/iA4/GU97/a3Zq3OJPHpQCWr0Su+mWcK xgGjMKK6gKSw1tLRpx1ujlV//2bC0m3EMZKZf2U3ok3za8biLbPzVba3Wc7RfCCMe3Cn If4mbMb4QbLryV2Mj5+pRbccL8WTbzUscRQd2bEKlZJK/Jpb4fbj1msXCNAGtCDIb5Cl St73kzUVh50cdv+DUywWECQdV2ZLEHKBiGojfT1LPvbosmBKV9JO57SnxsxRaf2fe8Ve XVvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id bt8-20020a632908000000b005891a066de8si4044813pgb.416.2023.10.13.01.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id A09F9839D9E4; Fri, 13 Oct 2023 01:59:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbjJMI7Z (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbjJMI6f (ORCPT ); Fri, 13 Oct 2023 04:58:35 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B115C9 for ; Fri, 13 Oct 2023 01:58:33 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L0p5GHyzLqXs; Fri, 13 Oct 2023 16:54:34 +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:31 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 18/19] mm: use folio_xchg_last_cpupid() in wp_page_reuse() Date: Fri, 13 Oct 2023 16:56:02 +0800 Message-ID: <20231013085603.1227349-19-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630170743612923 X-GMAIL-MSGID: 1779630170743612923 Convert to use folio_xchg_last_cpupid() in wp_page_reuse(), and remove page variable. Signed-off-by: Kefeng Wang --- mm/memory.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 6b58ceb0961f..e85c009917b4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3022,19 +3022,20 @@ static inline void wp_page_reuse(struct vm_fault *vmf, struct folio *folio) __releases(vmf->ptl) { struct vm_area_struct *vma = vmf->vma; - struct page *page = vmf->page; pte_t entry; VM_BUG_ON(!(vmf->flags & FAULT_FLAG_WRITE)); - VM_BUG_ON(folio && folio_test_anon(folio) && !PageAnonExclusive(page)); - /* - * Clear the pages cpupid information as the existing - * information potentially belongs to a now completely - * unrelated process. - */ - if (page) - page_cpupid_xchg_last(page, (1 << LAST_CPUPID_SHIFT) - 1); + if (folio) { + VM_BUG_ON(folio_test_anon(folio) && + !PageAnonExclusive(vmf->page)); + /* + * Clear the pages cpupid information as the existing + * information potentially belongs to a now completely + * unrelated process. + */ + folio_xchg_last_cpupid(folio, (1 << LAST_CPUPID_SHIFT) - 1); + } flush_cache_page(vma, vmf->address, pte_pfn(vmf->orig_pte)); entry = pte_mkyoung(vmf->orig_pte); From patchwork Fri Oct 13 08:56:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152422 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751994vqb; Fri, 13 Oct 2023 02:00:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkWX0AteOaYTyQO0onBL2/cBrSgoGICqtMvZ3ehFwcE1JVxS3k/WwOVIlb5wVienuOoDRJ X-Received: by 2002:a05:6359:219:b0:14a:cca4:5601 with SMTP id ej25-20020a056359021900b0014acca45601mr21078884rwb.3.1697187600909; Fri, 13 Oct 2023 02:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187600; cv=none; d=google.com; s=arc-20160816; b=N3Wqdg///lZADxjMXQbFdsj5R25O/nwNZKj861FpVvC/jmHAtrkcE6qYWEIfiqP5wg JtbQBTlezj37YS01vLA5i203rkmhhAXrQ5GEnRk37N6kPhq++ykXRicRvZiMkHl0UJu+ oJXPyslaA6jSFc3nV4JnmfMvmWgc20RQgN120j/uJQI+X4OsPwxbIdr1qDcv9e6t1anf 8bIVppLBXlmWafuy+Bu9rj5vnC+5MtMSyOOH+2LVk0k/RTbHZ1oDnOYVUgEzHedUuLtW mPBdyOaRDLJ2HvFhRg60TG2uqpgCwihln+QAVu+FHeiBbQDyQdRTim5reqGp0zGCjjzE BvEQ== 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=KMKcdjwd08Xk8ND6ULlLoLx+XBYNhLeLKyS742C9v9I=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=k7hfJTmplMIlnuY9TWSjhCpYQSqDWFt6M4esWJMvtCfEkoPyxKeOcXIfMs1TW+NXmK sPq6OMdZxvuwq9q+kSuBIcQCDcK/Sbs9sRjHNdzRm5uRtZaMUwH2i1rrkA6HZP8d0I+e 5heRTM7+dbQrjf1MSAtDxK9YzF1iFwtKZYNkhgntiY/vdzjknR61OXM3hCfVdihFuMwW j4DRWzyrrscbGrV/AWctuxOe5SzNZGZUIEwbE4TIe+Jtq87G3PWnbB1rGbPEOPPLGX31 EtbbIgCICmcqTf4cNy34584/jV/OagX5oTsjoGs2lnuNUQ4b7Hsx6cciWJvJZ++ZKtTF oaZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id cb12-20020a056a00430c00b0068ff0235e09si15770527pfb.61.2023.10.13.02.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:00:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 20C6C82B90C5; Fri, 13 Oct 2023 01:59:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbjJMI7b (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbjJMI6h (ORCPT ); Fri, 13 Oct 2023 04:58:37 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8BA8BE for ; Fri, 13 Oct 2023 01:58:33 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6L2M48t8zrTQw; Fri, 13 Oct 2023 16:55:55 +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:31 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 19/19] mm: remove page_cpupid_xchg_last() Date: Fri, 13 Oct 2023 16:56:03 +0800 Message-ID: <20231013085603.1227349-20-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:59:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630185286869599 X-GMAIL-MSGID: 1779630185286869599 Since all calls use folio_xchg_last_cpupid(), remove page_cpupid_xchg_last(). Signed-off-by: Kefeng Wang --- include/linux/mm.h | 19 +++++++------------ mm/mmzone.c | 6 +++--- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 70eae2e7d5e5..287d52ace444 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1694,9 +1694,9 @@ static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid) #define cpupid_match_pid(task, cpupid) __cpupid_match_pid(task->pid, cpupid) #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS -static inline int page_cpupid_xchg_last(struct page *page, int cpupid) +static inline int folio_xchg_last_cpupid(struct folio *folio, int cpupid) { - return xchg(&page->_last_cpupid, cpupid & LAST_CPUPID_MASK); + return xchg(&folio->_last_cpupid, cpupid & LAST_CPUPID_MASK); } static inline int folio_last_cpupid(struct folio *folio) @@ -1713,7 +1713,7 @@ static inline int folio_last_cpupid(struct folio *folio) return (folio->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK; } -extern int page_cpupid_xchg_last(struct page *page, int cpupid); +int folio_xchg_last_cpupid(struct folio *folio, int cpupid); static inline void page_cpupid_reset_last(struct page *page) { @@ -1725,8 +1725,8 @@ static inline int folio_xchg_access_time(struct folio *folio, int time) { int last_time; - last_time = page_cpupid_xchg_last(&folio->page, - time >> PAGE_ACCESS_TIME_BUCKETS); + last_time = folio_xchg_last_cpupid(folio, + time >> PAGE_ACCESS_TIME_BUCKETS); return last_time << PAGE_ACCESS_TIME_BUCKETS; } @@ -1740,9 +1740,9 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } } #else /* !CONFIG_NUMA_BALANCING */ -static inline int page_cpupid_xchg_last(struct page *page, int cpupid) +static inline int folio_xchg_last_cpupid(struct folio *folio, int cpupid) { - return page_to_nid(page); /* XXX */ + return folio_nid(folio); /* XXX */ } static inline int folio_xchg_access_time(struct folio *folio, int time) @@ -1794,11 +1794,6 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ -static inline int folio_xchg_last_cpupid(struct folio *folio, int cpupid) -{ - return page_cpupid_xchg_last(&folio->page, cpupid); -} - #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) /* diff --git a/mm/mmzone.c b/mm/mmzone.c index 68e1511be12d..b594d3f268fe 100644 --- a/mm/mmzone.c +++ b/mm/mmzone.c @@ -93,19 +93,19 @@ void lruvec_init(struct lruvec *lruvec) } #if defined(CONFIG_NUMA_BALANCING) && !defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) -int page_cpupid_xchg_last(struct page *page, int cpupid) +int folio_xchg_last_cpupid(struct folio *folio, int cpupid) { unsigned long old_flags, flags; int last_cpupid; - old_flags = READ_ONCE(page->flags); + old_flags = READ_ONCE(folio->flags); do { flags = old_flags; last_cpupid = (flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK; flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT); flags |= (cpupid & LAST_CPUPID_MASK) << LAST_CPUPID_PGSHIFT; - } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); + } while (unlikely(!try_cmpxchg(&folio->flags, &old_flags, flags))); return last_cpupid; }