From patchwork Tue Sep 26 00:52: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: 13398590 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 8DCA6E6FE31 for ; Tue, 26 Sep 2023 00:53:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 295678D005F; Mon, 25 Sep 2023 20:53:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 26A448D005C; Mon, 25 Sep 2023 20:53:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CA2B8D005F; Mon, 25 Sep 2023 20:53:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EE8EB8D0005 for ; Mon, 25 Sep 2023 20:53:46 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BD92B1C9D10 for ; Tue, 26 Sep 2023 00:53:46 +0000 (UTC) X-FDA: 81276926052.19.00B49FC Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf24.hostedemail.com (Postfix) with ESMTP id C34A8180014 for ; Tue, 26 Sep 2023 00:53:43 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695689625; 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=a0yIiMoZ+BRAnMLaOS2qTLnjbKRujtjPqddXRR5KgqA=; b=y4S1gD0lvTeEZ88/LAJbr5IkCJjDE9Ar85rJLoANg58N5irmh8E1J9vHY8mvXOwKWbW5kz 20Np4yND/+KzywyDXrFLac4F8miirn7pT1c43n17vCm0uYvD58DTgcXzEsiBEUJ2Mh9kJw +19tvW2g95SMhGHRO0mKXBgjsm3sJ8g= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695689625; a=rsa-sha256; cv=none; b=OaDwMZ+K6nsRu2vHvlQJ9KlM89X92jUWsVK9vme8N8VwFI2Gs4p/5S/5796gAH58GzXdvO j+ZyVVfgbKWdM5KtLx/buI7ZZHz4ZANM/kFrsLKc7USMaU5JroclaP6ZwtzkjkEmkrm39C Xy0HYvAebyQSyyMcPHwSVLXF/cb9Drw= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rvh4c62kfzrSw6; Tue, 26 Sep 2023 08:50:56 +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, 26 Sep 2023 08:53:10 +0800 From: Kefeng Wang To: Andrew Morton CC: Mike Rapoport , Matthew Wilcox , David Hildenbrand , , , , Zi Yan , Kefeng Wang Subject: [PATCH -next 5/9] mm: convert page_cpupid_last() to folio_cpupid_last() Date: Tue, 26 Sep 2023 08:52:50 +0800 Message-ID: <20230926005254.2861577-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230926005254.2861577-1-wangkefeng.wang@huawei.com> References: <20230926005254.2861577-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspam-User: X-Stat-Signature: 337monrt6eja8oq4b9t3gqzorpciqa4t X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C34A8180014 X-HE-Tag: 1695689623-190879 X-HE-Meta: U2FsdGVkX19B1hDjQX+UOVZMHAWBqA5fPt6Bb3ylDVA9LhFBFAsT+vOBuVIMDVHqTb2lbAH242rhbuzq4yfAf96t3rM2Owf3mXNs587JeG9reRoCAJ0+1CMfo6p7Q4YRkSceyVsgVK7g6LYEiy2NAab+B5QrubDsuxqqHXxbYC/yyfBVYs8ueIVsAf2qrP3/OjfKC56wghKwA+Xw9ERdx5TLrPnMc1gjrNCeGcwouKjx/jpObVI8s5P8D9fNa0FhUH+8aVCiISw82+TYjyAcM34RC20JwSvYgK+wQL0rvRFVyTontB5AsRT2yEkuFnH8GeBaxsrvotkNk3t9+hB+vButQEHvrcIO3E/TNdN7FvHla65euT18+cilWEneJtnadfiZc4XGxbFfMgxQ6iLD5rl3lPdc4q6Ydt8gxuvXQNO8wqLrmQBVgsESEnwYxc9kKGe6pofN92BHotIM8igp5jJz5tb8lPPB4DM8ZmAflRu+gSUMxOCmWQ6ZDmMjAWQJ9QKkAKOPqW96oR865cn9Vjirbr3yqIbCmRRRNJbf25PXX/+Cbv0oFo2dxs2DVaBlV4yYvBdf3PYCXujPHXPT4rNLSJx4C3eXnFLVIn9NwH+C97OUdWZzj9b7l2wRQU3b1g8i5ECEulYMpFvAGKtzeWZChCbQxOZ0CTrcfYLFxXmJOmr3RgmNJVNUnJZaW+vCvThkjOuBTJOe3Hd+xh73derle1C+/L2TprCVAI25kmn9vhQJqqLtLhYPZXVZOL177/bb5V/U56sZPlMQ6nfWbcwVgQ/plL0AuDRQPd4j89cEboYzxYgF0ObtnZENNZ41Nryei+gKPv3eVa4Jil8TZM5zryTRLYlXbM5Pv8QJga9GDv2NOY1b1ZieipIhIH5aKUM2FZeajePKZ/jYWs5zyXrn/eCPUpUNZAYhCMVDSyTU+njJIbIabSG5AlYVASl9lq+ttbPn8+odLFyi0Wo P1LPjCkc h31A+vgj1+gIBgH4h1KERwvqn+079ckPTUiEeyV9NG0nHF/wuLHRHLvBOhWyPzxysILRiRYODU9d2ZHh4bIM1fOPf3Z0ofa1tf5Ao3UIVj73wuiL4+iq0QOV4p9G0HOulynqhlZmGSFKuIMc23VsAmy/3OlGk5IZrertBPm5BObDY09Bgjm6tOHEJhA/0bX41k1Lo 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: 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 49b9fa383e7d..aa7fdda1b56c 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 c4f4951615fd..93981a759daf 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1555,7 +1555,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); @@ -2508,7 +2508,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 29c5618c91e5..5ab6e8d45a7d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4814,7 +4814,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);