From patchwork Wed Oct 18 14:07:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 154885 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4817698vqb; Wed, 18 Oct 2023 07:09:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFLt1SQDwmTzmJtbGEB1s10ovtQeETW1LUdy/ehkrU2IiseyWgUBQ49JU2cMaeXVKoXIHS X-Received: by 2002:a17:90b:4c91:b0:27d:3b8:a08a with SMTP id my17-20020a17090b4c9100b0027d03b8a08amr5734446pjb.1.1697638159593; Wed, 18 Oct 2023 07:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638159; cv=none; d=google.com; s=arc-20160816; b=WwMwT90jy6C4P6mnRBRnX9U7Qdb11HGy4+6MN6VrbopIIJO8gJnG43Aw/bHQ5SEnG1 f+pre1+a3WJKNOyt81XOIe0uBr+OUcWb7aJq3wwUArEeo5krcAaK2uaoU5S0sm/mA4Vx pyu/GDPeYnNK7tONOq2j009Mf4WnEgvmi9oXya8O/NFxY/rq31kt/qtgQtgDbgrq329n yxPds1eyz+5hYOeVfqna5fueWvYQ/5rXYetB6o69ukpiFvG+OstHp2FLaIMG/7AY65Fe aMGSRcsNGr91+ooDCGwCNdMU8+vnQ4N1UiFe/555EMbJAqjlqc00XyJlxRMsxv1+wILv 1fhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=42AZB0UhRDkADivyLQI4LDJLes6XAOA7/Y7eZodG6fA=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=Q4ahjVmpAhiSNGX/UjGG3N+lmwCf0U72h5bF4awXsnD4eoND1bfAXHDGSuubQ5N5Pg TlnmcuYF0iGPcMZrlD/QdpqjG8BP3SRR0GI1E6nyElQJjIcVyhDnqVbX2Rfcdb4A3P4m +UJ+BWxbgUOcwWNstLL82GJuV1KYBEBkXBFH4p+f7TL4sjCCL3/tmP7+3SgQIgbakDA3 3lSXMP40FMzS+h/MdR0G7bEepLBnewt3dmDwvm4ba+NH+WaoQg5zx+hkF0qGGWVnPBK3 5SewyO5spQk5a0dkK41rlyAnf8UwL5qlZDg68B9rRVMmCOO2sl8VuojSmUCC3eEEPczE iLeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ls8-20020a17090b350800b00279202f4151si1739936pjb.45.2023.10.18.07.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 18E09812DBFB; Wed, 18 Oct 2023 07:09:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344866AbjJROJM (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344828AbjJROJG (ORCPT ); Wed, 18 Oct 2023 10:09:06 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D421110D for ; Wed, 18 Oct 2023 07:09:04 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9Xh81z84zrTMP; Wed, 18 Oct 2023 22:06:16 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:08:59 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 01/19] mm_types: add virtual and _last_cpupid into struct folio Date: Wed, 18 Oct 2023 22:07:48 +0800 Message-ID: <20231018140806.2783514-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 07:09:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102630609828258 X-GMAIL-MSGID: 1780102630609828258 If WANT_PAGE_VIRTUAL and LAST_CPUPID_NOT_IN_PAGE_FLAGS defined, the 'virtual' and '_last_cpupid' are in struct page, and since _last_cpupid is used by numa balancing feature, it is better to move it before KMSAN metadata from struct page, also add them into struct folio to make us to access them from folio directly. Signed-off-by: Kefeng Wang --- include/linux/mm_types.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index cc8bb767c003..34466be945a9 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -199,6 +199,10 @@ struct page { not kmapped, ie. highmem) */ #endif /* WANT_PAGE_VIRTUAL */ +#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS + int _last_cpupid; +#endif + #ifdef CONFIG_KMSAN /* * KMSAN metadata for this page: @@ -210,10 +214,6 @@ struct page { struct page *kmsan_shadow; struct page *kmsan_origin; #endif - -#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS - int _last_cpupid; -#endif } _struct_page_alignment; /* @@ -272,6 +272,8 @@ typedef struct { * @_refcount: Do not access this member directly. Use folio_ref_count() * to find how many references there are to this folio. * @memcg_data: Memory Control Group data. + * @virtual: Virtual address in the kernel direct map. + * @_last_cpupid: IDs of last CPU and last process that accessed the folio. * @_entire_mapcount: Do not use directly, call folio_entire_mapcount(). * @_nr_pages_mapped: Do not use directly, call folio_mapcount(). * @_pincount: Do not use directly, call folio_maybe_dma_pinned(). @@ -317,6 +319,12 @@ struct folio { atomic_t _refcount; #ifdef CONFIG_MEMCG unsigned long memcg_data; +#endif +#if defined(WANT_PAGE_VIRTUAL) + void *virtual; +#endif +#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS + int _last_cpupid; #endif /* private: the union with struct page is transitional */ }; @@ -373,6 +381,12 @@ FOLIO_MATCH(_refcount, _refcount); #ifdef CONFIG_MEMCG FOLIO_MATCH(memcg_data, memcg_data); #endif +#if defined(WANT_PAGE_VIRTUAL) +FOLIO_MATCH(virtual, virtual); +#endif +#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS +FOLIO_MATCH(_last_cpupid, _last_cpupid); +#endif #undef FOLIO_MATCH #define FOLIO_MATCH(pg, fl) \ static_assert(offsetof(struct folio, fl) == \ From patchwork Wed Oct 18 14:07: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: 154901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4819353vqb; Wed, 18 Oct 2023 07:11:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFosggjfMO31QqZE6bK+Oi7dYzClywyWpRu1JYgSYbCFAs0ZsEsIKoerRSOPHbUR0Kt8K3u X-Received: by 2002:a05:6a20:7d97:b0:171:947f:465b with SMTP id v23-20020a056a207d9700b00171947f465bmr5236792pzj.4.1697638284737; Wed, 18 Oct 2023 07:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638284; cv=none; d=google.com; s=arc-20160816; b=zSi6Iq3nVHZDUEwKEdnHOMS8fOX8ADMJ09N62zk8NQU6kOHyf/nbNPrkq2/k4KjHMk yNn392gx7qx06lcA34fcOegfT2kFWldi2eiISTyW2yr0bV8S/iXI+gDF7yyU6UISqjm9 Wl7IExSv0HFXfMP9xSnzdRXdLcl3diY4DLkheEYTwq1zMl5H+rvuvN5Ac5HNQFgsiiZR vjPrJVME1/l0VI1Mnr8VUIArDmZkOM7UQVBDID/abShqokLanBTonLgXKOy4tfsxVjMf UArp6paBa8vmNCCJy5m6uZ8BduqqVf2xxKIT4czPNR1DbqiSskNWasdiqtutqtMLWcdb ZmlQ== 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=i6ZulqmDVziFGMVHho7qxz8QbM7wQNfnY4zarTes5eJo7p6Bl33Krnys8uNuQJqdTK 6tDJaJrBGZ7lfHq135aku3RsCLFYkYJYsTsBEKF8sN/do3LAI5oC8zltwYVyrjsh8iod mN7BjyLK2/q/3P2oxlEU1Dp0M5T7CA43VN5LERiUx7sCWA5u+rLd2BLSqbeiLAQdLmVk sZO9SITRfLsb1av1SQgi3nL/G8zC69uThZfK/AWu/oO+9SZ9wnwqUcPmTBYl3yCiHWuT tZ0xPK+oYtRV7wEScaBydtV454tWcbW6pKD8Fx+q+ShaXGB+PFzjn2HnpyKS4dJx5EFS oyFA== 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 x189-20020a6386c6000000b00578bd92e502si2210805pgd.558.2023.10.18.07.11.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:11:24 -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 6E4828184E02; Wed, 18 Oct 2023 07:10:13 -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 S1345002AbjJROKC (ORCPT + 23 others); Wed, 18 Oct 2023 10:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344903AbjJROJZ (ORCPT ); Wed, 18 Oct 2023 10:09:25 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 239BE123 for ; Wed, 18 Oct 2023 07:09:14 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S9Xfj0G7qzCrRT; Wed, 18 Oct 2023 22:05:01 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:00 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 02/19] mm: add folio_last_cpupid() Date: Wed, 18 Oct 2023 22:07:49 +0800 Message-ID: <20231018140806.2783514-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:10:13 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102761836356671 X-GMAIL-MSGID: 1780102761836356671 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 Wed Oct 18 14:07: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: 154887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4817800vqb; Wed, 18 Oct 2023 07:09:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErUWMdsnwGfZN3gzdU9MZ4S4mx0mxQ/fVGNpH56ybylE9gdlm7glvBjOJ0bS26dPV4hBn9 X-Received: by 2002:a05:6a00:2a41:b0:6bc:67ca:671d with SMTP id cf1-20020a056a002a4100b006bc67ca671dmr5179457pfb.1.1697638166785; Wed, 18 Oct 2023 07:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638166; cv=none; d=google.com; s=arc-20160816; b=godanv8B4GWmHn9qP6+X3JkCsl1myqkq16GBs4lC2jHf/2u7KTeFLPgBZlEhW4LCNs FCCjwcvomS0+GSa7pfr1a7kc17gLAft7zpC84vb9Kmx5BVk7RcdmVc+s9t2pt5EI16Yy ktohMMyBG1e3Tao94SAoqeFz8uerTalktssaSpmQPjmBOfZKdS2mPtCoj/1kQkdbd4Jv KiWVyCCwe/ir9KUUCn64pvxIZcEmkx+EAWU2pLhzA5unYpm9qxfZiOB0SYUOj3clnc6g WoFlFRER81QcVlxQ4HlY/MddA4za6SXfa9YIUeUG8wqTNn7ERBwIXpyizqfB3LElrHVa BApg== 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=JdQVJrAElfKng+OYmkwm9YRwHbUqwZeyP6t8cnejx4CPjRQUIKvMqEA0B2+hStT759 qCdyeAZ6O6RFKugHZMQ3/ZhELmX206hRnRUNyhl1fFPRO0c+WlkPtv0nPlNotbQuteme /oMjo7CYiJ1JRW0jBtLu6xKi+RiOZYyRWMyTH7b7EtViFrWFPjE+Sjx+Z0YNv462kBNc dxp6A1Ggi6KwBfqGTgENzk1vEA2+9oFn1YZzwJ2VQu6midHp1JIvFvtDSOa8Ys208gCh fV5rJWZnTApARutFSmYzYbfTl8bDin8+GHnCQ/FPOMzraCLqk3cJucN39/IYJFcoDTPC qUrQ== 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 x31-20020a056a00189f00b006b728259b67si4153812pfh.177.2023.10.18.07.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:26 -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 E58B180DBAD2; Wed, 18 Oct 2023 07:09:21 -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 S1344854AbjJROJJ (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231918AbjJROJG (ORCPT ); Wed, 18 Oct 2023 10:09:06 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E14C106 for ; Wed, 18 Oct 2023 07:09:04 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9Xh93L0qzrTNS; Wed, 18 Oct 2023 22:06:17 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:00 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 03/19] mm: memory: use folio_last_cpupid() in do_numa_page() Date: Wed, 18 Oct 2023 22:07:50 +0800 Message-ID: <20231018140806.2783514-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102638234479000 X-GMAIL-MSGID: 1780102638234479000 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 Wed Oct 18 14:07: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: 154889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4817845vqb; Wed, 18 Oct 2023 07:09:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfndFojNifvWvYF+QLIKbb8a32uURIxAcTPNwhq3Hvd3R75O8fC0ZJFqHP2LjXlUd7ABwY X-Received: by 2002:a17:90b:4f88:b0:274:99ed:a80c with SMTP id qe8-20020a17090b4f8800b0027499eda80cmr5730985pjb.3.1697638169158; Wed, 18 Oct 2023 07:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638169; cv=none; d=google.com; s=arc-20160816; b=hZ93S41QkBu69Hg7HVZM05CmxX+O0hU6nUhEDOFLbIIrxlPnvlzeYcahuzvUdZG8Xe 0HAFghNGebQqZTWr1JQO7+SGT89n/sMupKRHl5pe+q/8Qvn1JV9WLtyavcl2WFAiLoW7 tPlJ9bCcOrQqgcu1SlrVmqQSpCCHDqbYU3lsb4c4OwnLmvkQLB3QZxe+U00KO4X8DA8H DELE5frGqvCn0Zkzyr5thIMWLIKt1iCEK9M7XYsNlD8JulJGmSIhpSdjrpwvL0Koz2wi n26yGyZXA624e7IffIZdgOM/Gkxqs/E/2GCl3wo62WpSLa9CFvdDY4oKfJMGdrrCHOZa vK4Q== 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=c/iF8ISvNxVC4ZZRiSLJdAmUVU1OUPoFpEZMSvxM7tSleJIkNA5NR1FJSFP+/xD6Sr Z3KaHT1KezGQeD01OwUMAM0i+bsQN0An3LKI6EEEztLLDkLLTv2T5hOE2bRnqlsE+i9L ZNdy0A2wWj3mxsjhlReakEFPIdPYEWlqppb3xOUJDj14eEYSdt/awxUkgi95fYcwJi6h 8XBCZfO+EWUQiN4tPunq6mukwzR7ohA3pudXctMiPRNOsJMX8EappmQPgNrfchpcBL6w /12hgbxGhireYrCdYAFIqsEWvUwU9e5XcdN4eHURkBf15V3AFcTjB7eUThiCP55nY6jy /AXw== 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 x4-20020a17090a970400b0026816382fdbsi1452495pjo.40.2023.10.18.07.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:29 -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 D7000817C3E8; Wed, 18 Oct 2023 07:09:24 -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 S1344830AbjJROJG (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231860AbjJROJF (ORCPT ); Wed, 18 Oct 2023 10:09:05 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF4E1FA for ; Wed, 18 Oct 2023 07:09:03 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9XhB0sD5zrTNh; Wed, 18 Oct 2023 22:06:18 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:01 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 04/19] mm: huge_memory: use folio_last_cpupid() in do_huge_pmd_numa_page() Date: Wed, 18 Oct 2023 22:07:51 +0800 Message-ID: <20231018140806.2783514-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102640945839747 X-GMAIL-MSGID: 1780102640945839747 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 Wed Oct 18 14:07: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: 154886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4817714vqb; Wed, 18 Oct 2023 07:09:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnCYdvOIVtELDML43mtT/Wh5kjJNzrtq+mENcUs5GVMSfcTb1jZuPWTuO8tw0VOUqR1r2B X-Received: by 2002:a05:6e02:2145:b0:34f:7ba2:50e8 with SMTP id d5-20020a056e02214500b0034f7ba250e8mr6373069ilv.2.1697638160510; Wed, 18 Oct 2023 07:09:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638160; cv=none; d=google.com; s=arc-20160816; b=pvs/cI70rAvxiQCM/YWtrD6Axblangh8+8xKDUJTR5Vmhj2aFKknWt6CAhi2vTOpSO 1raJ45mJqBcVEMKIzD2woTEEQmigVClZssNZvPIIYOCL5sqi2QT2n4R5CfqRwYcI8yDG Ffqvmm+A22pFyURF8SZXFK0ZZfnu1w3Yh9Ui5pM+kNwGU3ecRmOVrfJTUfJEphQ+t4Zy g68DD32fLTDLXguFSSmx1fQBOKJR6KHvKzXHO0CvvZIQztLqFGh6tWNPd3D0RXckryL1 od78wTpjB5fz9BmN4yFDwMTDRmU1AtPuruIxawLfbf9uK//3CoHAMVvA/XtuYBMxYxgf Ttig== 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=vnlRJhUdCjKNLd4GS7Oazw4i+fuFkaxB8z96ZMp0Lo+pFVdoXtqhjIu3ZI0DT40I7u umxJExvaXfyi5j66zpfF2qpcQv3fS/K8wZWJRjqx1t3QjHDg7yRkwMST47NjJUmAu7Fj 4//kaM00ARF3ML1lm+ZpDs6kVgViJ5zTgTqf4C+QA9zhLZEXzg6BHh6XI/hYIsrcMfPb F4FsY5L8+0MeHAqHBHHKvssKs5aoHVLg6uxz+3jVn5+w+cBTcN3ZGQUYj9Cgy4YDI+CH ONK01vVK4MlZCAJjDdWa7MNjHi8thB0UX5A47cqsTa29ctTlI3c09RpDsFo4doolhZRw 7j2g== 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 f9-20020a639c09000000b005ae4b7cdd6asi2047189pge.284.2023.10.18.07.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:20 -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 226188131AA3; Wed, 18 Oct 2023 07:09:19 -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 S1344875AbjJROJP (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344835AbjJROJH (ORCPT ); Wed, 18 Oct 2023 10:09:07 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8917BFA for ; Wed, 18 Oct 2023 07:09:05 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S9Xg561TqzRt3s; Wed, 18 Oct 2023 22:05:21 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:01 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 05/19] mm: huge_memory: use folio_last_cpupid() in __split_huge_page_tail() Date: Wed, 18 Oct 2023 22:07:52 +0800 Message-ID: <20231018140806.2783514-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102632172959170 X-GMAIL-MSGID: 1780102632172959170 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 Wed Oct 18 14:07: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: 154891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4817995vqb; Wed, 18 Oct 2023 07:09:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHM/lJmApUEc6YZS7zexOc0UBroNEF9uUwt9sk24tLBceWBYTLxOA0S2CeLf7JYCp5URdP2 X-Received: by 2002:a17:902:d1c2:b0:1c7:1eed:10f2 with SMTP id g2-20020a170902d1c200b001c71eed10f2mr5319432plb.2.1697638180736; Wed, 18 Oct 2023 07:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638180; cv=none; d=google.com; s=arc-20160816; b=i0OJLBGD82vAJvb/HKaoYVhWHiXoGP01/Pi41vJ44sIKDc2nrWdZjULqCoiB9ewWrT DpKHaF9DBuU1EuUVOgT13pmiNBQkz6sTqL68JcJiasoQ/VqxZzvm2/TJH7g9x66KqSpc 7JCKRe4RyG02VG0FOEgDBxiL6W4MIGVX+JQ9geXirmsHx1t9tLQyilVYNBkpcXv4E+pF uhCPJDzo4zXZbtfLHH2apl8xADAkteZ3nXmqEWfvQExYgFftTTNhh2kOwkkJeLbHaT8t 4PA0TqUq/bVmrvQ6KpaRybrmgTopiZyccO16FQJMFmJiTRHKSJJ1JluE8aCRIJX3AH5D 5cRw== 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=nckVPlKF5vl899eYLQUbKC2Eo8C70lAJs3MlNB6EffqujvjYDZ4dYrBvKSoR9wU+uH PGImqQyPYm1lizARmDblC29Vl4WoMrHfRQka117n8fR+Jt9yz9mBkA06+gapIU6p6xhB x2DpJbh0CyzaI+6u/aECeKZcrQZt5kPC4CjpEeXOXOTNRcPyDETXBtcwoGrg0M5oVwqj 8TBrf2CsfkKkeSJ4GATzBc5pMwvw/T0xNyCNK49lTxyvedZnjgRYrzgj751jn8rgsuqz L/ceeJlA04rfoKQ5KyWbxnh3lKLPGMKH6aj0669rQ1CcDOBNpDA/KL1gq4Exyjsea2x9 WBaw== 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 s14-20020a170902ea0e00b001c9b20887afsi4479621plg.431.2023.10.18.07.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:40 -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 A2D148166905; Wed, 18 Oct 2023 07:09:34 -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 S1344906AbjJROJ2 (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344859AbjJROJL (ORCPT ); Wed, 18 Oct 2023 10:09:11 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6562E106 for ; Wed, 18 Oct 2023 07:09:06 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4S9Xfd2h8yzLp6H; Wed, 18 Oct 2023 22:04: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; Wed, 18 Oct 2023 22:09:02 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 06/19] mm: remove page_cpupid_last() Date: Wed, 18 Oct 2023 22:07:53 +0800 Message-ID: <20231018140806.2783514-7-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102652992374366 X-GMAIL-MSGID: 1780102652992374366 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 Wed Oct 18 14:07: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: 154892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4818038vqb; Wed, 18 Oct 2023 07:09:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEc4yspsHq+l5cTiaXSokiRo8+KkjjuE+nTvSg80PMgSj6yrg+eVwkSEPM123PS7Pd7YL+Q X-Received: by 2002:a17:902:fb45:b0:1bb:83ec:832 with SMTP id lf5-20020a170902fb4500b001bb83ec0832mr5158112plb.2.1697638183874; Wed, 18 Oct 2023 07:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638183; cv=none; d=google.com; s=arc-20160816; b=fNeLUCiCXD/OG70r7r9vJFBtwxoloBh4nZMGWmdciwSJQjaUOYFDI2B4TerEyQHfOd 87vSzu+EMQO0rGT5WBsyIJpJAsnF5pSUfeLh5tPkJ9P7nCDf6dN5hkDPRBM7Ql8WRomD TwQFZzWCLfnL36Z8tG1u2G7NCO9L2YbZqK3pfT/UOFDQMMBMgPm97FJ0GX/yIKMzTF/s MgAAuVwNeOmcbpsqiYEXOZdgKHhuDV91zWlxEYu7J1urz6GtPB+dtx0DnbeSAyJVfy/E PFPFJ5U4DWjMpVaiN96xMu5vIjW7BDRnavlaV6cu3jLeDjK0NpZXW6aopAEcnmDIJKIP +sPg== 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=piSjqgO6QkjQxWRdlvU7tdJY/Lp0dCe5jylbbvbAPbgoCTq8UvmH4UOSotF+jowKAy n2bbLoHi4j/F965gNv2QGR9nT4jXScwt9UjttSE7UTemrFqTn0EsfaKaFQ1zwAzYDe/T S6z070JJnnDMt29oNHMwdm4lca8T6a5TpRK85v4eOdRXhiPqVNwjWK8BFwzbmKOGL7Ug Fl6iqHaHn4VPhbfvfugSOD/BXLXesdFN4tEdsE7ORWZ76EWzUxRwTGA3ee8bgHsb7FT9 F5DKwWFsn+5cSkWfwdZtYOcH0l23T0SGUva+rDa6SLM/TnVrFXAJ0rP6kGxvq4Wlzzk9 IPYA== 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 i6-20020a170902c94600b001c9c579d28bsi4423834pla.247.2023.10.18.07.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:43 -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 91B8A8166910; Wed, 18 Oct 2023 07:09:36 -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 S1344908AbjJROJd (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344855AbjJROJK (ORCPT ); Wed, 18 Oct 2023 10:09:10 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E49E10F for ; Wed, 18 Oct 2023 07:09:08 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9Xdt5dLmzvQ8j; Wed, 18 Oct 2023 22:04:18 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:03 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 07/19] mm: add folio_xchg_access_time() Date: Wed, 18 Oct 2023 22:07:54 +0800 Message-ID: <20231018140806.2783514-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 07:09:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102656225905411 X-GMAIL-MSGID: 1780102656225905411 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 Wed Oct 18 14:07: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: 154888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4817813vqb; Wed, 18 Oct 2023 07:09:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG0INDeYHlxXH60sGMgzXdXBRPQ5pARpEmSwnSgEVidM3tJODHO/F3sjtG8K5K2aIYIBae3 X-Received: by 2002:a05:6a20:ceaa:b0:13f:65ca:52a2 with SMTP id if42-20020a056a20ceaa00b0013f65ca52a2mr5122468pzb.5.1697638167503; Wed, 18 Oct 2023 07:09:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638167; cv=none; d=google.com; s=arc-20160816; b=SCwHw1Fy9skVMNS0poKq5dQEg7bDpLPc798Ph929QfWBfyJR15dHxeE6NPea1NmT+j U4q1Q/F/+L4Ftv3fjwlpDoH/I0LVymTHluUq3NaWCLEk9n/iVyzMNQYa4A5MEIFoFjAe +D4mBr+x4cpKhnf9Y1b9XTsaxh+TXzL1NZRDi4Oq+lmC3V3eCP2Nl2U13fGC++vR1/aM BehdUyfA3JDWzulyJ0ZSr0y3KPwWZ8OsC1vI2Q6Kz4Hueh5XJ0mEdJASYwy45Iq1vuws VW+FrJflsL0WwIORPvJr7Ryycm5xvSTYuOfZwS0ROvgpig5mlmgK+cHTyKnp6fDStPuj Nmjw== 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=MSt120ujaCbI5iqH61p99iQMj5WX9vWzUelkG1NabO0=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=m7j7N/ssNzr6kSt9HZ8ak1kgir/PDWHT1s+cfU54JlTeOZrbaLrJr9THwOBUVwcYxC Elm/d35wDqvIm7XBYu5u/NyWyZ6iqf0GmQLLkhrQXHEPwPrMg5eEvRvNPtcFs9iBsXQW qQV6KlFi1/GPKwfv70q18F9vnkAKOkeotqLn4/NMwd9i/4znMjc+C9+MCZ9SfOkxBI/s Sf5k4E69yPc2eAtInk0wEONdRNbzE88c+bSi989kru9o4UhPCRx8ZfdaaLJAPHaPv8yB Y2fPrc9F/Hp+nNSb9JDXPdhh+z5vdGbdlWHWmKYU79QQcDJ7EhPaXmxgdNk90/vKido1 Z2ZQ== 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 h71-20020a63834a000000b005ad727cfd10si2120418pge.132.2023.10.18.07.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:27 -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 AD84C813CDA1; Wed, 18 Oct 2023 07:09:25 -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 S231918AbjJROJR (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344843AbjJROJH (ORCPT ); Wed, 18 Oct 2023 10:09:07 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B1F95 for ; Wed, 18 Oct 2023 07:09:06 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S9Xfm5FCJzCrSB; Wed, 18 Oct 2023 22:05:04 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:03 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 08/19] sched/fair: use folio_xchg_access_time() in numa_hint_fault_latency() Date: Wed, 18 Oct 2023 22:07:55 +0800 Message-ID: <20231018140806.2783514-9-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102638891368308 X-GMAIL-MSGID: 1780102638891368308 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 c50271f39d91..b8c52893b3d9 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 Wed Oct 18 14:07: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: 154890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4817856vqb; Wed, 18 Oct 2023 07:09:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGj5iLRLYrkLkU+j7ZGlWspMFYODinfPqlJK96fWCnmwOQLUSXxDcssiW6vVc7iD30BLZ3b X-Received: by 2002:a05:6358:e927:b0:166:d9c3:941d with SMTP id gk39-20020a056358e92700b00166d9c3941dmr5755326rwb.3.1697638170437; Wed, 18 Oct 2023 07:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638170; cv=none; d=google.com; s=arc-20160816; b=T18dVXt7S9DDCXhdwHbFDg7G7OW/hMfMSV5H7v+Gl0hs/5ozWaFg8QrZKigo4yS7B+ uWmFDMjx1XK0KOBjZw1r1nb2KyAIOp1r+rtCzivqjzpPZzVuGtOqspYvfts8yMMmqkyI 2RkJO4oTyyz87+n2vLWWV05sRHMTSt65tm1OJWKpBkL5W35eIPd7e9uOCn5vrK4acfTZ PoUw6mXeKFh0GdT+jREzSIjamtjnTi0AyFNGtlzFVR9msU6Qg/V/hA6khot5S8hTWwV/ qCf/C1zX/xHJy2V3mkBD4ZI7VMLRf0frTHkFPZDHSr9i/BLhz3NPRlAX9xWSb0xQK9b/ rdwQ== 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=+SExSAFdXGenEFq34IiGWjXXWvTPNv7RgaHg/hl0yTY=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=a2iHWcAU0O95LlisGpRlyOHiwF0ZN6xIeI24xxa2zgbGwxGEg0o2x0CwPqepK28TJv nylBCpE8jfk5FPmbZVZ8TVeAlb3bm4xqdYczl7PyLYdE+XvllPnQMLigAvcWN0jtFIfU ocFu9WW2jpPu+ukH5z4HLfgkZWxkbWVDLj8SLBMxp7Cou47nR6rabAQS5MpUs1M9GMrW pWrmyP1x9qdPyLvBD+fxj3lF/F1+r3Y0QmCyq6GtPUdDIYU+1CPN5q330UHqG6NkRp/9 6JLTxs/8BCF2567+dvvn4iB8+thGa7FRZKtraQ+vd6iCOSgvWA/YE0YZwHqdFqRAhZUC XmUA== 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 67-20020a630246000000b00578bacd7fc7si2178322pgc.713.2023.10.18.07.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:30 -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 A0FB6812DBEE; Wed, 18 Oct 2023 07:09:27 -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 S1344845AbjJROJU (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231901AbjJROJI (ORCPT ); Wed, 18 Oct 2023 10:09:08 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E467FA for ; Wed, 18 Oct 2023 07:09:07 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S9XhF6Tn5z15NWX; Wed, 18 Oct 2023 22:06:21 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:04 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 09/19] mm: mprotect: use a folio in change_pte_range() Date: Wed, 18 Oct 2023 22:07:56 +0800 Message-ID: <20231018140806.2783514-10-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102642089866111 X-GMAIL-MSGID: 1780102642089866111 Use a folio in change_pte_range() to save three compound_head() calls. Since now only normal and PMD-mapped page is handled by numa balancing, it is enough to only update the entire folio's access time. 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 Wed Oct 18 14:07: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: 154897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4818302vqb; Wed, 18 Oct 2023 07:10:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFv3fK77BIgWnUNSIF/14rDNSoJu686FrJ4pnPT+0Skr6ekAXjUxfs0UBllznBbiGI00DE+ X-Received: by 2002:a05:6a00:1c92:b0:690:d0d4:6fb0 with SMTP id y18-20020a056a001c9200b00690d0d46fb0mr5428821pfw.3.1697638202389; Wed, 18 Oct 2023 07:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638202; cv=none; d=google.com; s=arc-20160816; b=iaUFkG7r0AagpjCmJS7skEgpoXO0MyTtKbSiBsP/9McIrMKocAshDVWEItCH8QBOmt olkTnzDdmzo7VPN743rw2uJbM/KZJMi0HIElz+RYXBoW0ilmavG6jpdDRja/68fA1eu2 lXnE+9pSaLn3JdcC8Pkhyn0ZesPudFgChxJuUj4rSQOZfEu5NLJjSgQXOnJJLHWYT4Lp NzSH8+5m2c9cNOhMkwn16izbKsz1dJNlH+b/IcYiCMMmvGHKuQSlR8mrO+8vqmmIQaX3 UXHCFwl8azGEGoid9e13M3MP8UYyg4yMguTQOfgDmCZA+v/Rz3iO18fL2f/n+mYjUUul /b8g== 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=It25NxDJ1GQwku4IzV4a2HWg5jbxh+f5OlakU3rQa8JgMb7d6pxOsAdBX3HPoqPsHq y57g7IvuxuiQnQ1RHQ1Fs6VAwDFh0F3fvmbcK5W06N3nCGF5zXiQPrk2rn/5N6D74WjZ t1/ElYULhRlU6WxloEmxWsZSl6l7RnUicc5Nf74sdtoGBsJQtzJ4tmGYWjtUdiWpluMK m9ltYG2dv5ZKga5Vxren1TRbdfsuW8kDUbnkqoVjflsfpY9kLtWHX0dE4BKEzEPwpRJy ZJc4lCLMIFVFeUfYO8k09AoLI4eMDmqohwGS7UVBHBE41nFt0vvIKrYFYviU90+T80Qv +IHQ== 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:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id by3-20020a056a02058300b00578b9757214si2450949pgb.163.2023.10.18.07.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:10:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 30448802940E; Wed, 18 Oct 2023 07:09:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344901AbjJROJY (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344856AbjJROJK (ORCPT ); Wed, 18 Oct 2023 10:09:10 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE5B095 for ; Wed, 18 Oct 2023 07:09:07 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9Xdw4TSzzvQ9v; Wed, 18 Oct 2023 22:04:20 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:04 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 10/19] mm: huge_memory: use a folio in change_huge_pmd() Date: Wed, 18 Oct 2023 22:07:57 +0800 Message-ID: <20231018140806.2783514-11-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 07:09:56 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102675711861792 X-GMAIL-MSGID: 1780102675711861792 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 Wed Oct 18 14:07: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: 154895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4818219vqb; Wed, 18 Oct 2023 07:09:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG0nFk+87mPzZUvuSr7Qtuzr/GUix5YUVNQJwpwvLUP2Y1zFQBp98naunsuY2oawAGxX62I X-Received: by 2002:a17:90b:1b44:b0:274:60c7:e15a with SMTP id nv4-20020a17090b1b4400b0027460c7e15amr5727208pjb.4.1697638197634; Wed, 18 Oct 2023 07:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638197; cv=none; d=google.com; s=arc-20160816; b=GzAKL9VcoPDehSvLFc95V2EEIFimnGUdNVTe8OdujHIhbWy7akv21vc8lNJZl92c81 6sfDlS7QClm+bxE2Z8URmU8lYFbn0TziUumSaM577xDH4MFOFThATQeHutvllHU/aglB z1WKEnbF1OQjqvJFfzUAH0yrQYFlKub4EXN0yWAO3Yq+jB9hi/vnKEcuOY0Q7ZrqgCB6 VrbqWJsRFjOfGgNLgQs3e1TOiKrBZMIpTALPPOCBqEBXUDlmFNp6O93Jlvmd8eXfGq/y Mo8dTV7fTgUuqEWJ7KBrHoHNZPuZrBOrn6nGtW7J8hdOQpJ6iY2HnvNJINbhr1zb26Va AjTQ== 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=GSh+umoPoWEkalEeIh09+5CIRJB/CP/lDpL5pOlezn8PqeCIdyrVTdwpXLE83Z/ZaV y3mrkkM9ErLFGMUbdIqw6NUN8RUcL6ijepNSdU5JCS6czOdiyfgleeSGOtMRQoin/RJM a9OEU59kChgvf2dAx4GeFRpk9T7sjmzhogfgP9bBl5nXtRI2DVmC+bm0tiLv42EsSp6D S7PP8pD9qBy5u7wR6bTLUT/CKDyrcAMUzJ7shIBWRA91qqDUMCKTzZ6WDTyfDe4LO86s 0C7MFSlFFmtjVp7bCHsIKVsRzEafUIdwW6aXjDUZgiZuiznos6WbgpLVoYZ2DA9smThR mdew== 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 h4-20020a17090acf0400b0027749a98349si1618913pju.4.2023.10.18.07.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:57 -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 E8FA1817C3C7; Wed, 18 Oct 2023 07:09:52 -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 S1344896AbjJROJV (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344853AbjJROJJ (ORCPT ); Wed, 18 Oct 2023 10:09:09 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 282DD10D for ; Wed, 18 Oct 2023 07:09:08 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S9Xg93f9RzRt5H; Wed, 18 Oct 2023 22:05: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; Wed, 18 Oct 2023 22:09:05 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 11/19] mm: remove xchg_page_access_time() Date: Wed, 18 Oct 2023 22:07:58 +0800 Message-ID: <20231018140806.2783514-12-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102670535343518 X-GMAIL-MSGID: 1780102670535343518 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 Wed Oct 18 14:07: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: 154894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4818159vqb; Wed, 18 Oct 2023 07:09:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5TccQZKLGrOibF5dgO4a8KOOnFwLto8GHdA7HtREKo/Zm198mq2+vDUcirdEVUf6iKX9p X-Received: by 2002:a05:6a20:9741:b0:163:ab09:196d with SMTP id hs1-20020a056a20974100b00163ab09196dmr4952047pzc.1.1697638193180; Wed, 18 Oct 2023 07:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638193; cv=none; d=google.com; s=arc-20160816; b=AoSTQg9cRd2WMuYaHI1YpOi/dGwvJLWxCyiwewREO4JYKuW8o+7eVuWhvM6O4kf8CG dsjPLCmzqNtLf9hUhiC7qEHxP6SZXa2034WkqFnNa6LKmxP1vr0+yVSQl2yKngqq4oim 3YbTeZe19bKqHo+HUtoCStRjm2JKMiblfOhix4EVC6UY0jyRmrU63+3e05PpuncVQaGe qsA4sc/67Oz8Su8Sai+FVcmOmCl6lDrEqI3YTDYg/GWmg3WQCaj7nJ0kZUymVAgVI1Qg aA5wMQXx11Gb32taWqFlWYBfiHQBtvfYd3grJ8lYN+WrbTfl3QY1mrgWRErAF3XOErVO 7orw== 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=YBKgfqBz9/BjHeIeE4EUOZqmeQFnCFILrCM/ue/FnBWmu0K4XLVz24eCXVC9WQBGo1 FLlbf4LB6q+mk9eVyx9zCeS/I3mxbW6XIlp/3mkwj5nfmKlXrH7iWQk2JTlkt/obmmdo 2+MQqy3YBYxY7hZYzreq4hXPp82G7+qr14/0QeK+doUYTVr2lc6x1DoXZGZB8HlqRZhA r8yjVQrbB5U3mG88IM+multqpaphwLV167Ly2MUd71+3eJj2aLDZvAk9WtixycENdVW+ X0v0XRwt0VilNy4FurnuXCfNcsgzX9T9nAGpQ309aNoGeRmFig6kkC5sFkRCZNy2x3xO +kUQ== 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 co24-20020a17090afe9800b0027000086c93si1483001pjb.102.2023.10.18.07.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:53 -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 CC90F817C892; Wed, 18 Oct 2023 07:09:48 -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 S1344898AbjJROJg (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344861AbjJROJL (ORCPT ); Wed, 18 Oct 2023 10:09:11 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14AF3FA for ; Wed, 18 Oct 2023 07:09:09 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S9XhH50l8z15NWq; Wed, 18 Oct 2023 22:06:23 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:06 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 12/19] mm: add folio_xchg_last_cpupid() Date: Wed, 18 Oct 2023 22:07:59 +0800 Message-ID: <20231018140806.2783514-13-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102665955559077 X-GMAIL-MSGID: 1780102665955559077 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 Wed Oct 18 14:08: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: 154903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4819432vqb; Wed, 18 Oct 2023 07:11:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXYVH5v4dPW9WCW38V+ZD3IFjHYNNyD4Y4S3cyjVuYW9iEcqPAhbTGxj98XBsdmHpmp93h X-Received: by 2002:a17:902:dace:b0:1ca:8e79:53ae with SMTP id q14-20020a170902dace00b001ca8e7953aemr5419528plx.1.1697638288315; Wed, 18 Oct 2023 07:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638288; cv=none; d=google.com; s=arc-20160816; b=sfIFk7uwufWCQOLhHXhZuAV4ckdbVPcMnv7fFnM5z3oNWpbAcG/y4xUhi0tQUWShsy nvvhAL4G89bfFdFM+UgMKcBTilQj0fRZvJYaGCwZcVZ/PbIImKYdar7yzf9AKy6yexJS IgIAsdFrPTiOX4g6qQh1HyrFa3Xtr4nty85bnxWUSriTbj7qaV3YkOxQObl3UT82M24L U4eF49VVcmQImbk4Jz+OYDWEueANjjms/HmEMJ4mbAqLce4kPOfhZaaEE3f4G3jM4RWL K7GolnajbpRDZvUO360EgYMA4akeoNUv75tCenOfUCp4pSeeY8sN/lrsZHoCSzxzS//M fs0g== 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=RlBbZypv6yE/hTj8++hHCKN5K1x2FYqLwI5an1ekiHg=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=1BxuhrSOla4qAqCTu9yJqsxYHMbC6eqJWo2xHYOFUsatICRvCL9F76LmUB8FZfNqKy BcHjJVm+yEEzi0I9den7Et8Pu4hP7C1xjzHTSf7xoYdGnLSuieZDjiflzbJtkqjgNLjv 7tAeyl33pqCN8uoWRTdC4m/uisDjZJe309Hoi0iO/xOtAF3ddBKmZAM/IpprOalTmyhO vj0qkuTlJl5FY7sfuGSmsIerQvhgsd3ZQSYuvCKwYhLqasfqGgImLjpUCSariORExBLI I2B4AeFx55oDqyfTAO4PmGUfgvFwHpFQcBoyW323HbgYT8iZCUkXmq9AybE8zaPRJDSF sZng== 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 m14-20020a170902f64e00b001ca73864563si1216272plg.232.2023.10.18.07.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:11:28 -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 A81AC808E674; Wed, 18 Oct 2023 07:10:18 -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 S1344923AbjJROJj (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344858AbjJROJM (ORCPT ); Wed, 18 Oct 2023 10:09:12 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 770E4112 for ; Wed, 18 Oct 2023 07:09:10 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S9Xfq5SM4zCrSG; Wed, 18 Oct 2023 22:05:07 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:06 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 13/19] sched/fair: use folio_xchg_last_cpupid() in should_numa_migrate_memory() Date: Wed, 18 Oct 2023 22:08:00 +0800 Message-ID: <20231018140806.2783514-14-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:10:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102765690006471 X-GMAIL-MSGID: 1780102765690006471 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 b8c52893b3d9..bafac84f7be9 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 Wed Oct 18 14:08: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: 154893 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4818156vqb; Wed, 18 Oct 2023 07:09:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxoAVVQM7hAtgPh4sfN1W3bJaTvA3v5GyJoJFngoAGEYvo7TSeEnbPnaTQ8XS4oFeMVtrB X-Received: by 2002:a05:6359:8001:b0:166:db65:af9a with SMTP id rc1-20020a056359800100b00166db65af9amr4680194rwb.2.1697638193137; Wed, 18 Oct 2023 07:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638193; cv=none; d=google.com; s=arc-20160816; b=XrS65vtpooHDDW6xjI8qlOYwLoFMrXY56Oq6HmOcPhO8IT/qvEDs6IEECF5lcHBtAt IWw2sZ/RoZgj0stUyHyG1so3DFOyIOJ2xdMAnxZ9QXAEtITlv7+kRBty3tUFrV5TFiXV fj4g9Zm1qsWlUgsfPQP4TKwwUvl9XheqeN33+fYtyl145UnVf5TbqfC45tRXb5N3lw8F Ij4quDpKFSxXC4vLL8rBY+JttrWT/yjs8sgpvsXn3XiE3vy/k+dzM+BBCJXwFsw0pkH9 s5dOmfSOhzxNROacl1cH0uqV3rn2/30STGlPwWOqY1myYPWQO09vzUcu8BZ3aAIYzKuS jSwQ== 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=Q8/NbHrxLojMvb1UM+q/LaYAUp+7Z16CYAMsaz7ydpup/t/IyhgHdOi0p/fvxFFdg8 TJOi9+PGApHUvAV/OIXuE7YVadrF2fMzM1fEOyfXc4UcpCbgWFnEW7lEcdKGxz4TpIgW ckVUS9v6iCAY4uorCcLwivbrrWyk5w17WsL5d1SkjaeY/JLYtBC1d7jeYbFqmNx/bRZn RSR7oIKfc9YwL3y+djgo3dzQACJPN+XXFXymCEKKajT4F3l3v0uW6CrwQDL0ftQyjCTC 4tmquLYOekGgeTumM00Nfl2PdSX5lNnXs6ieA+hUe4/hbjPKPfoIfh6CnJstrcfz8p8a J6Nw== 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 z125-20020a633383000000b005b7d9ab1cc5si2171005pgz.646.2023.10.18.07.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:09:53 -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 E22D3816690D; Wed, 18 Oct 2023 07:09:46 -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 S1344949AbjJROJm (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344868AbjJROJN (ORCPT ); Wed, 18 Oct 2023 10:09:13 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82DA4109 for ; Wed, 18 Oct 2023 07:09:11 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S9XhJ6mgGz15NX0; Wed, 18 Oct 2023 22:06:24 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:07 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 14/19] mm: migrate: use folio_xchg_last_cpupid() in folio_migrate_flags() Date: Wed, 18 Oct 2023 22:08:01 +0800 Message-ID: <20231018140806.2783514-15-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102665832222788 X-GMAIL-MSGID: 1780102665832222788 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 Wed Oct 18 14:08: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: 154899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4819150vqb; Wed, 18 Oct 2023 07:11:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxV5KdNd3giGnzph7+AUT1H8wQh6lRH9xbH8etEWK1JL9bi3DX2oIk+CWWgUUiunKc1WfE X-Received: by 2002:a05:6a21:a5a0:b0:17a:e03f:38b7 with SMTP id gd32-20020a056a21a5a000b0017ae03f38b7mr5713359pzc.6.1697638269799; Wed, 18 Oct 2023 07:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638269; cv=none; d=google.com; s=arc-20160816; b=x8mhSmxeYSXYXP4rMqrGVuhiH3DNWBXwcF++idkJheQoTSE3n8Q4Jl5OQe85Eopecy 7McMkkAOE3OkAreF2yKcA50y97GfBOYE43Wo7RcHe15ahdEZkaJyXfIi3ktE2XRIPYgq r8sIk6QCffTF1llBNBvOgMu4FkChEGTQfTDDl/73XdOJeygWSsVjt3B1L7SLiRMBepp2 w/7SxzxMz3ql2KYYlRaX1o+gXgtfQhhjDJcwESpLWjzSFK1vnOOhOgdwLfFs29iI5V/L xRYFQe0MEDIO+HawzPOxY8XiqZhJShFnJjaj0gkiZGnUJFhl1jKOHlyj1h0UKQdxhn5f iwFw== 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=WgFvsDCvqt77llje/mbg0ZZEQ6iXtAtt/vyC8+gDa1fJzcqMhiOdR80u/7PTpvMWGY S2TrXpnM1aBQ8ZiEJnlaqa7hMlRDLE8yHkPJnKALNVX7B28fs3ntREq7STMrzCLk1+BL aBmTEtAegjUdef16mRKTOakfN/zE5BZJ2Vocd96tqY9P6sueJRGD4eBlzv55yPQKGPuI bKV4l1XRU51hcsLET//3bKT7nzfzqPKnCnyZRTuCGWBjQ7syvwwfN7df6hxM2WgInrlM URKRTptnUaG7OVhyC8V5LHKA4tj1trMLpphGTEub7otD+n7/ZsfbJECpU2i/fIcpFLJW wInw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i5-20020a633c45000000b00578daf0f3a5si2264740pgn.873.2023.10.18.07.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:11:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 0B0658075B19; Wed, 18 Oct 2023 07:10:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344812AbjJROJr (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344867AbjJROJN (ORCPT ); Wed, 18 Oct 2023 10:09:13 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC2CFA for ; Wed, 18 Oct 2023 07:09:11 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S9Xfr71CvzCrSJ; Wed, 18 Oct 2023 22:05:08 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:07 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 15/19] mm: huge_memory: use folio_xchg_last_cpupid() in __split_huge_page_tail() Date: Wed, 18 Oct 2023 22:08:02 +0800 Message-ID: <20231018140806.2783514-16-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 07:10:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102746356338953 X-GMAIL-MSGID: 1780102746356338953 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 Wed Oct 18 14:08: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: 154896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4818264vqb; Wed, 18 Oct 2023 07:10:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDbuWHQRYHsyq8KWO9JwcaanVdb0IAt77wI/cMbfHnJyEyqbLRaYs6+Migik2h+rGP/7g/ X-Received: by 2002:a05:6a21:8cc5:b0:15c:b7ba:e9ba with SMTP id ta5-20020a056a218cc500b0015cb7bae9bamr4791085pzb.0.1697638200736; Wed, 18 Oct 2023 07:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638200; cv=none; d=google.com; s=arc-20160816; b=ye/KM1PnNo0z3ruIMOh3Zg/rk6OCAMAHSWEQ+FHXtcHI2DQXIZO2XEtXv2j1yR0A3X GLRxMoB9m7+VawZqyD8fTlBKX5MdxU26VpjG3oqpma5paquY2JUV3/2HxSIbBR6AKKu8 npXGJdxUueATGP6cT+XgkSGcc6bxN07XP9atgfQ4NhSGoLP6Zq+8PvB2x42GblW1AVo+ xSwySOywBOuY36JKnUQM9YeuOgKSjmDWkR1+jehJ8VW6b1zRtivBg1z01opD80zPAguf romR5kHRtVSxmyOCmgLZdFc3oWIixwUvg2vhJJb9OjoCS4Gtn/TprlzOVCo1b4i75dJu ZlJw== 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=q+uA0+NXWM2WkkRqDTUmyBKqFB7VX95FBh+BxRdNaPxFBoSihvMAxKK4oiFPuXuxmS XOEP5q0onTC+BvPHURN0rq4yHRr15MM7cZGZxhFX3NzuNiE9j6WSRH+XLiDIXpaPcQs0 hLXirUQMacQG90K0zZ+caKnjSySmrcs/4bnQ97MhkZb+dr/URdH6NbB7K3xZ4HPp6NDo 5zxc0U7GcqX2q7SAdVTeuFL/gS4F+s3UF/BKJYp/qRsrLAiaAK8SHIdUn+dgAojItym6 +hV5caaYpT6oUbWs7Muo13N1dSbyLrSHu6at3ekaGzZkG7vRvA0NK3xM1rrW6N8UX0JT FM9A== 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 a8-20020a63e408000000b005859cd26197si2135036pgi.455.2023.10.18.07.10.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:10:00 -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 A10B881BEC98; Wed, 18 Oct 2023 07:09:58 -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 S1344976AbjJROJv (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344887AbjJROJT (ORCPT ); Wed, 18 Oct 2023 10:09:19 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E11D118 for ; Wed, 18 Oct 2023 07:09:12 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9Xf01sH2zvQBS; Wed, 18 Oct 2023 22:04:24 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 22:09:08 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 16/19] mm: make finish_mkwrite_fault() static Date: Wed, 18 Oct 2023 22:08:03 +0800 Message-ID: <20231018140806.2783514-17-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:09:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102673911282109 X-GMAIL-MSGID: 1780102673911282109 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 Wed Oct 18 14:08:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 154900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4819243vqb; Wed, 18 Oct 2023 07:11:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnH/JowyRnWWqT0En5LSinZr+X++9N8qoK12bV7qH4HM5Ty4yPqhkrUfhZrUcKBl9hWGWX X-Received: by 2002:a17:902:f092:b0:1bb:ac37:384b with SMTP id p18-20020a170902f09200b001bbac37384bmr5362743pla.6.1697638277304; Wed, 18 Oct 2023 07:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638277; cv=none; d=google.com; s=arc-20160816; b=sjZlCDTKY2Yu8VmVRI7K39X1TNQtgtSP8FmUsIjKyOMV9iSROnvCEg9+Di6/cShj/S EK0dpfdXvCpAkLf8Zbj1jhrIhze+RBASc9tnG67BFKPayM+GoDkJi8SS+TEIrw+QCj7O eX62xu0oSOdEBs119foWQyNp1HF3Yz4wrx3DQpUGHjgyvDvEKqEagzBtQ/vdRi4ti+d3 +OqtB6io06MZ5I7mDILIck08lC2hqV1/x/yLV6HZz4UsbHTFSe+0f2l3HW06EMUVtQJS ddw8QloeOWsCJ0uftaTUrnOE1CPVeCEsgLBLwQQBnl3q1PcAd86IHgohQGtfpvo/B8mn BoMQ== 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=Ydl5R/Os1oCYcNiMi7C125hjKrYLYWYSyaLxBm8zeC0=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=OCagftFK4Nkf2G2lOwmyl3P0/mxxN/y7P5emEdakqyJUhY5EMKn65EdATSDE/LB1mW Lj0l6Nlc7KrcBddK34Q5r5b51KBG541y8OKiT3eXrHTFAS4mWX+6QwdttffaaO42pRcd /szrba7+oJ76EEIfca5s3sLScdYCGrjxPWXKP2+xPVsG3ONAa8HGHYlikhYUM6PvfR3R YwOqNnLez2daUH5wmA8DqBkAgQyBTW7Y1HsZujjO3alJGaKqkEJWijx2X1K71RrxHnk9 QKPQPADxdSNrGRxMlfjGQqNE/ckwhoF0uuTztCbqr5/sRKNrn5BAf5fFPOwvCubMFElS SGKg== 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 i4-20020a17090332c400b001c9ad30e4b8si4441880plr.320.2023.10.18.07.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:11:17 -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 2F8BE809E88C; Wed, 18 Oct 2023 07:10:37 -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 S1345010AbjJROKE (ORCPT + 23 others); Wed, 18 Oct 2023 10:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344892AbjJROJT (ORCPT ); Wed, 18 Oct 2023 10:09:19 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64011112 for ; Wed, 18 Oct 2023 07:09:12 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S9XhL5QYkz15NX8; Wed, 18 Oct 2023 22:06: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; Wed, 18 Oct 2023 22:09:09 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 17/19] mm: convert wp_page_reuse() and finish_mkwrite_fault() to take a folio Date: Wed, 18 Oct 2023 22:08:04 +0800 Message-ID: <20231018140806.2783514-18-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:10:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102754592960301 X-GMAIL-MSGID: 1780102754592960301 Saves one compound_head() call, also in preparation for page_cpupid_xchg_last() conversion. 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 b6cc24257683..037da118f1d1 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 @@ -3261,6 +3261,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) * writeable once the page is prepared * * @vmf: structure describing the fault + * @folio: the folio of vmf->page * * This function handles all that is needed to finish a write page fault in a * shared mapping due to PTE being read-only once the mapped page is prepared. @@ -3272,7 +3273,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 +3289,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 +3313,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 +3343,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 +3495,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 Wed Oct 18 14:08:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 154898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4818350vqb; Wed, 18 Oct 2023 07:10:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtqvAiP1eqMwhjzCcjc99D7ANyPCOaII6nAVzQqSRW9xHivbn5+sbeISQhPVenyhlN5X/R X-Received: by 2002:a05:6a21:8cc5:b0:15c:b7ba:e9ba with SMTP id ta5-20020a056a218cc500b0015cb7bae9bamr4791392pzb.0.1697638206714; Wed, 18 Oct 2023 07:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638206; cv=none; d=google.com; s=arc-20160816; b=yn+IQbrp2c8rjsxtTWrIrXspUs4uvi4gqNxa/HoZvgyIlbsg6lSu7JkNq4mPOfUgKT M/UoPV+lDSZK+nkd5oSzFC6YrXih+LUZbfjlZw3yig4vcvxzzgZfM7SjpjNS3OPgH9ii UoEFZoksYgezqnmrB2ekn8kZpfTR35/nnvo7zIM1bMycy4wjX2VgccJiNBAJlCVcWerT rZfAfDFAT+/R7V0K0H8AcICODLRn4XtAU3sVAhvGmysnXH02YiptTk0DN4pbPv78CU+8 Ts6oCVz9OB/Bl9qrfkXs7pP77lIKQCFSyuWZOSJUf1nO+F1bXaPVsxIha75if0xBJkGp GkDA== 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=z6mhHbia0tgVbcgOllnNbvBMUqnXaQ9x0wWBWtbmQ/I=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=E6MajkTowMKZ81UtmOK5Di7ay/ac/bt8Yp7wmhSLnGoNVevOHXC6uvVgQCneBlW+e7 rZGuCFiOyzZRzYsNQ1O5Lvi9pdgkAVWjzPM5DFpPYjGyxH54R/omjRvWOtx6d6aY/NdQ h+G/hv7FhA9ru2R/57MZVmLBtXxLcLMIJatgb7nws4EcOcbcnB5sd+1zfGz1xenGpRAx 3l75P4aKn1JslImDCs/ZFhaeMkXwfyMlEMLYDZ4XxlGZp+cO6kXOWm6gvFaerjkqN7Qr NwgvmJEYq3k8N0CFWKsZqZJqs2/m6XusQ5CH6I3WujneYtIQetN01weobzmUA+jy14hG VKwg== 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 i131-20020a636d89000000b005655bf61e32si2151111pgc.23.2023.10.18.07.10.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:10:06 -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 8B34C816692E; Wed, 18 Oct 2023 07:10:05 -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 S1344944AbjJROJ6 (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344890AbjJROJT (ORCPT ); Wed, 18 Oct 2023 10:09:19 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C823E11A for ; Wed, 18 Oct 2023 07:09:12 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9XhL4X7YzrTQF; Wed, 18 Oct 2023 22:06: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; Wed, 18 Oct 2023 22:09:09 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 18/19] mm: use folio_xchg_last_cpupid() in wp_page_reuse() Date: Wed, 18 Oct 2023 22:08:05 +0800 Message-ID: <20231018140806.2783514-19-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 07:10:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102680424071058 X-GMAIL-MSGID: 1780102680424071058 Convert to use folio_xchg_last_cpupid() in wp_page_reuse(), and remove page variable. Since now only normal and PMD-mapped page is handled by numa balancing, it's enough to only update the entire folio's last cpupid. 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 037da118f1d1..4f0dfbd5e4bf 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 folio's 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 Wed Oct 18 14:08:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 154902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4819430vqb; Wed, 18 Oct 2023 07:11:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHm9K4BCvaKar8pUM033+rcbS8VlGRzXHdkO6EuWBYl7TQwSfWw51QxBULKWqKYk8R+Cd77 X-Received: by 2002:a05:6e02:2145:b0:34f:7ba2:50e8 with SMTP id d5-20020a056e02214500b0034f7ba250e8mr6381199ilv.2.1697638288344; Wed, 18 Oct 2023 07:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638288; cv=none; d=google.com; s=arc-20160816; b=bEDjcka8fUjVT/OrOeUFaJeznrp6b7bkR+EKFL9YhDiZ46DYPLxshn1NdrLPKPXKhs bjj84QPy8xv6DNR7/zYiVUZJULEyjcYzmqojLd3gTyNHzYU41VMF+B0NxdGoubs7o+Xn T99PA8BSIMhxTMiyEM388/jVTFQai8+TjO0EtdWm7ZCV9B09nG1B1MBdqssXUJC3mnB9 4y3KaDxcgCGukYt7Q6BQtY0QW0gBQq+jS2QbtP9I1/LBVD3kRdTW8AFdtGLgrid3r7p6 b9R8BmWi+bN46sk/D0TjxKYRQJG5gzqkv3TM3T+Gl/EsJwW5ttH28uQlLzY4o9X2bN9t phXg== 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=rGuRAmMMQoSr45ujpOWd6w3TGWyO/qLg6IoHjsBdE6PdUZtM47EVWJ+Lujc52GtNZl te4Q9RMM5fl5+kY/wdbxgkUBVoraijj+4yQW1NgHrXqCtH54bjKV9La2keUwmd+IyQJk qLY/JwUVsxr/3BQ4Q5n2R90AnHDdrmurqArOxtfZMUM1rWzuW3jbl7bcXexsAeEPZJxG 1ntPkcr6l/fO9c47yHmeSbUhP9FQs4zXWchEUWW1TvsbUP4zvT1bqeY2QDPi2HTWRpaY yCWhDvrQlw2q/Jd+DszoolR/scfLF3rM9o9Z1gWxwPmJ4dFciYpM7WqKxcXvzbaWSsRX WkZQ== 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:3 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. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b15-20020a63d30f000000b005b81f21a25csi2245189pgg.830.2023.10.18.07.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:11:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 A3326808E664; Wed, 18 Oct 2023 07:10:18 -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 S1344997AbjJROKA (ORCPT + 23 others); Wed, 18 Oct 2023 10:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344902AbjJROJZ (ORCPT ); Wed, 18 Oct 2023 10:09:25 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88199120 for ; Wed, 18 Oct 2023 07:09:13 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S9XgG2pm6zRt5M; Wed, 18 Oct 2023 22:05: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; Wed, 18 Oct 2023 22:09:10 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 19/19] mm: remove page_cpupid_xchg_last() Date: Wed, 18 Oct 2023 22:08:06 +0800 Message-ID: <20231018140806.2783514-20-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-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]); Wed, 18 Oct 2023 07:10:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102765734115320 X-GMAIL-MSGID: 1780102765734115320 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; }