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: 13414852 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 0325CCD68F5 for ; Tue, 10 Oct 2023 06:47:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 920CC6B01F6; Tue, 10 Oct 2023 02:47:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A81F6B01F8; Tue, 10 Oct 2023 02:47:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 797556B01F9; Tue, 10 Oct 2023 02:47:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6B47C6B01F6 for ; Tue, 10 Oct 2023 02:47:18 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 409DA4019A for ; Tue, 10 Oct 2023 06:47:18 +0000 (UTC) X-FDA: 81328620156.10.1BAC152 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf10.hostedemail.com (Postfix) with ESMTP id 9E0C7C001C for ; Tue, 10 Oct 2023 06:47:15 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 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=1696920436; 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=baB2eiq6BCK3AFEnCs/tq/2dYE5yNXN+wqPc4weU9iw=; b=iIb8zHcs915pbdO9mrl9ZxK3eRGgeK0P9nf3/3CED390wpUHjShz3a/VrURID45MIH3+bd wcQknJ7NmOL9KNluCHS6FvRmVXMjk4IZZhzZTRC7KM0BjocefaGKquxm4C/MRTT+qryx8u aPS/4edzX8rAtA15/E6LsF3wNBlGrf4= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696920436; a=rsa-sha256; cv=none; b=iozeL0XspDRvHUBEgd6v3npkMv3GOjSuaglvfK+57FbO/ogqBcvdFTlwGKdNmt7f4TogNC rP6r2Md0Y/w1YzIoROb2+Rhf8Kr7Fq7nEpyt+P5MlLkGe4hDgAvozdEGKdZc+OhzlefoXV WNEV/lcGhJs7uwB3zjwrpYHeDyZyYwI= 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-Rspamd-Queue-Id: 9E0C7C001C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: huh3n5fobgqumr69q1e6tiyz9zs6npwo X-HE-Tag: 1696920435-394086 X-HE-Meta: U2FsdGVkX1/0dg2/Nune2QlkAzcepnQ9msNPEmxIrODCpz5AYwn7DgEsloPIk40LNuevAtfC8EEIZNvzq0pOKdQ9lW/M/6l77KubdETfSfoimJDsLPPmtO+kNP1CXmtxlOOlTIdBoBRzurDPi4nov/0N/JiQB6ofUFImmxNuHCj2/5PijdTTbdHW4eAe2C6l7EJ+Iq5xg127NkrBeExBtYLv0vlY1KSHswQqbHTIY789Aqr5p121wM3KkBpL37281Dr/dvc2iaPhEysjH3fIysxDjCMDnXjXd6ALig4V8LeWD8CELJxXKC+RrP/GQdTC2q5IK+EvDneoQ2xCQ4SGoaCQNDD7F1+UjImQ8mfpXTjizyMDKayah/5P6o3K71Qu2jzwx/lBZ3byMNaF50EE/mYWZMtkGA6/tdwJhEXygppc0ou8jVZXns6qslw8lk83zgOqEaBmXVmBdmzXmP2DOrqyXWhJmKVmrWmPGd0jiKuFEtD/vWQCk7SW264v1HGIWm3c59Dtb56VmzYzuCFC1qo32IPvsX/yVMQDWdf01z/y6G3cM2QY9PaAyajZ1JNuFveq0xfPJ3JqAVppRfWydPIus/Dgz524AtHvRtUJ9LPY6xkVHKVUOHGfbBR0B3ELhVtDneAYqt6CwBsH07IECYonaAvd4Puk4ElVvfgjj/7FB7y8EgWfdWlwzMcqT3jacd0ekylcK3O4/4uiFU2xrnVc3g/1O7r+CCHBQQME6y/TcT86lDVk+3CSDpQeoiDhvaQIsHzIWNlNSSM04sWTzZxeN022uKbuOU0pBw2vCtD1Pg3Lo7h3tmXBlN12suvp3TD+JLdmQ+bsepxiJ5gxUb8HhGpnhW3MEdiy0Dd7edjKPdqj2hvlyO9OEj9M14/k8LktofvPTzopMZYhyqjK6gshXoeQhz5abyqb5+nYvCgJAoUKih2+YTR0A7TTdympUSx/05aDVbOgty1iBN3 T8w4t7Wp TW5qNRL+Te3Vn3UJW2nTb4+RLEKBkeZTK2ml8dBgH0sMGRsQ6vPTv4mA9aTICbhlJUJrv0LqVtuXb7sBeLMYjHgijlRayX9YoS/eN5rQaXYs4x3wqaK/pyW3p4FTfFlcAi9GCSTjV+GFg1aejoi0tf3q3Q3AP1oGVFdkiXLneiLJhiI9Wx/vTaEkxBYZNDG8XoZxa 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 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);