From patchwork Tue Oct 10 06:45:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 150495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1534vqb; Mon, 9 Oct 2023 23:47:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7bZrRwM90c/jboXugDTKpkg8zujM6/LOXWAWgjK8Q6EdOEXsfG00hJAz4KuuJgU7alVlw X-Received: by 2002:a05:6a20:918d:b0:16b:9b5d:155d with SMTP id v13-20020a056a20918d00b0016b9b5d155dmr8683771pzd.30.1696920446997; Mon, 09 Oct 2023 23:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696920446; cv=none; d=google.com; s=arc-20160816; b=LTLJuuoEfrOnHHlcT/+ZkWiLMqZZrJQ2ltJ9cQdo1PkyBO1ivD5g3n2PINbEbteDy0 9iMZAEhIJn2P6JxNxKh0qaGCbCdnU5SkrZnl+MZnke1EMPHj0x7bgFeDeJBreHuG3Yn6 ZWcXJM9TfjfTeI5f5P8Ksk/y9lQcds4oUYueM/ahf0PmtYyV+Yv/WMmT+Yv29S2WOACI ojOHXH9vZ7pplEAYV2cSl+Fk/JkEJqyIZJFws/Wzh1bcSyHsh1LeqrDdKosUv9lrLi/A eQs7picBQj1/ZTsmYJG+VQMYZ8HeO4lTlm7Q5GAfXZlYRoFumdzxP6bk4iP+smgrychk KWwg== 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=baB2eiq6BCK3AFEnCs/tq/2dYE5yNXN+wqPc4weU9iw=; fh=wFvkM9osNU8sYLmqaGTuFInFBWzcJKoGp+WLNOXGmbE=; b=ugDSc3sY8ekiXPrtgpHYPod3wEdRWIjNQ8Hq8iZ4puPkVFL1Fyb7JA93YvN7Sl8zW/ QFNtqwgQOtg9wyDwpPCo9z0XlFj1sQcd3f/4eSwYAJaJWSXphVtY3Z/RSqk60caRsxNh aQPUsfMERDAmlCFGhuQK4rcXgLE9OaG0kicNcm0ZOYsPYUvqUgkHyPWHyIwdvJb5CLcN gIDTzkGFgemVRz7Hqu0pKznqPB7JU2WADp7SznZdbewmjPOr0K7YhvMSNIViblZHnSNI FXP4gZG5I1ZTNixCBG8GHyrpF7AMJVFngwt/m6zX+ltO1OXY100jKu2k6sNHXo3p6Kri 0O9w== 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 fb40-20020a056a002da800b0068ff3927553si8988783pfb.35.2023.10.09.23.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 23:47:26 -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 2E7EC8129AD1; Mon, 9 Oct 2023 23:47:26 -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 S1442347AbjJJGrU (ORCPT + 20 others); Tue, 10 Oct 2023 02:47:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442300AbjJJGrL (ORCPT ); Tue, 10 Oct 2023 02:47:11 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6532CA4 for ; Mon, 9 Oct 2023 23:47:09 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4S4RDZ6fnSzkY3J; Tue, 10 Oct 2023 14:43:10 +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; Tue, 10 Oct 2023 14:47:07 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Kefeng Wang Subject: [PATCH -next 5/7] mm: convert page_cpupid_last() to folio_cpupid_last() Date: Tue, 10 Oct 2023 14:45:42 +0800 Message-ID: <20231010064544.4162286-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231010064544.4162286-1-wangkefeng.wang@huawei.com> References: <20231010064544.4162286-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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]); Mon, 09 Oct 2023 23:47:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779350054992403147 X-GMAIL-MSGID: 1779350054992403147 Make page_cpupid_last() to take a folio, and rename it to folio_cpupid_last() since all callers with a folio. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 12 ++++++------ mm/huge_memory.c | 4 ++-- mm/memory.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 13ca63efacf7..e0bd8abae6c6 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1689,18 +1689,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_cpupid_last(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_cpupid_last(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); @@ -1740,9 +1740,9 @@ static inline int xchg_folio_access_time(struct folio *folio, int time) return 0; } -static inline int page_cpupid_last(struct page *page) +static inline int folio_cpupid_last(struct folio *folio) { - return page_to_nid(page); /* XXX */ + return folio_nid(folio); /* XXX */ } static inline int cpupid_to_nid(int cpupid) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index e85238ac1d5c..3b37367eaeff 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_cpupid_last(folio); target_nid = numa_migrate_prep(folio, vma, haddr, nid, &flags); if (target_nid == NUMA_NO_NODE) { folio_put(folio); @@ -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, page_cpupid_last(head)); + page_cpupid_xchg_last(page_tail, folio_cpupid_last(folio)); /* * always add to the tail because some iterators expect new diff --git a/mm/memory.c b/mm/memory.c index c4b4aa4c1180..7566955d88e3 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_cpupid_last(folio); target_nid = numa_migrate_prep(folio, vma, vmf->address, nid, &flags); if (target_nid == NUMA_NO_NODE) { folio_put(folio);