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: 13427128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5D8DCDB483 for ; Wed, 18 Oct 2023 14:09:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 032BB6B01A6; Wed, 18 Oct 2023 10:09:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F25F880015; Wed, 18 Oct 2023 10:09:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEEB980014; Wed, 18 Oct 2023 10:09:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D01C66B01A6 for ; Wed, 18 Oct 2023 10:09:13 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A95B0801BC for ; Wed, 18 Oct 2023 14:09:13 +0000 (UTC) X-FDA: 81358764186.28.FDEE810 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf19.hostedemail.com (Postfix) with ESMTP id 325161A0028 for ; Wed, 18 Oct 2023 14:09:10 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697638151; a=rsa-sha256; cv=none; b=rLkQcfg3bRlBMBT/Yz97AGSiyVNwctnbcpYrPzberd9sYMKqt8cQ7l/l0Ei7zX402jNuLX BIbSH5prqqmZEpoztlvI7rPSwmmlU8dcg0waeJA9npBGPwh0mISJvEb6sYH5Pm21twkqNx oQ0WHnfpc/xcHbXqSNXjuyYdge6Y9os= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697638151; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ONiFhuoJXZyIBus5P7d1IKd0msDLCi+tp53vVhwi8Pw=; b=op8Q72vCOPqJzV9EatI2kYc0/dPACyIHkPTKt2qmrFJgQ4qdWCi3j8tio/xLUdzZzzHXO5 1MUTXDGAwwQ05fJ2T4mY7JFxUBuED8gzhklxkhZPbNt8ySLwuJ/C5spG8UzL7+O7awD/TD QfhBK3lM4fLvxKjKPCQ1Qmc6JTI71DQ= 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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 325161A0028 X-Stat-Signature: pezuoyfbydj3g33d94j8h9az3g567565 X-HE-Tag: 1697638150-357804 X-HE-Meta: U2FsdGVkX18whbFzMNV0fAVF9/NhMCE8fniiOm7JyFQW00eI9/e1vTNLnmUKeRwaq+El/2sV3TCFjs7NiNm/FZF0K41zormCBOAsr/SOnSYwH2nu6L5JxGuva8iVIBKfPmFXU/bLSxUxAT7TjMGtPSQ12W79hnP4br+8EWWcSRIEF48iHXcxTXu8plvGwOzlvM2YBDbAWYvOCkGoNjsGFsgHj0iwi9ZkWdWnRibFHh1EMYOOis2/NOuqkYiJZutd6ombkDvzpiVViUPNpqRGzTmvzIAw6FoYdeHI7AMpeEqDWubbMR8W+7SmWCsXLja9+OAl3JBRLpHipYSk65v6a3kEh9BHmSPaNrEMK2NRxZ4/OVlFOMaQHaIJFazxu3McHgW06pKVYoe3sJbTHe4+QwFnvy7Re3C5bHhKDjvkwe6PRb1FoER0iiTsfd3lnRKbXC2GrpgNlMvXY4f632Dti9dj5ixyWS6g1d6m6KTGfyQfB0kQxloVmh38dItiTebTdv92st87XHszMcslz3D4WXA3NxnjLAkyUDmyWwhyG7gKmvLgXhMeNbzH/3GErSeznPDy/uYcCJaNgdJRD1347PSihAWdxTaAeyEAJKNMe+au22KZd8IYEzToAnEoEtK+BcgIWPAP4g5+J4t+rQBz1C3hyrnqOK43cRO5AxWe4XWxTs/+4lk2kHQ9twmxK6DRB4z2mDiKGxKDzS7A40fiaoiSXP9DP6LwOx7+wEcmvUnizwEMZbm17/am7pxqJ1CkQRXtbkV2ENV5Ukg98yJAP4XUOJDXQUz5nQ218GtQlxmlEVcSvmgDD4BWmQTXb3JlbhjeCywON5Ld3utpPsgm/0dzdxaRD22gdVrp46PMhW4mVCwVWYOFf7LTX7NejO9bsNV2ImOQfLXtpkvpF/Ur2Do4ksnoWGyuckAVoDmZQkEpSdbsd0Fzbu0K6GMYCKB/rDkeQYAR79w4WFOpCsx Mk7MmDp0 kPDve89nBHV72vGZr6BWPNKqL9tfk81qELE2SDHIot2oAGDjxMFZ8gRmL6VHcR9Boa1S9DSPWi05km47th8x5yjL6n0h29YF9kOSXNl/uxVzY0pGAbJCrCWRN6MbT9qENe8Di8zK8+Dh40ehXHmZDprLD2+/tLhPkTAvy+jOET0p3QQYY5ZxT9yUu80/fj6XSq32k X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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); /*