From patchwork Tue Oct 10 06:45:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13414875 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 CB173CD68F5 for ; Tue, 10 Oct 2023 07:07:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 696958D00AE; Tue, 10 Oct 2023 03:07:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 646438D006D; Tue, 10 Oct 2023 03:07:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5356B8D00AE; Tue, 10 Oct 2023 03:07:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 449798D006D for ; Tue, 10 Oct 2023 03:07:34 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0F45A1201BA for ; Tue, 10 Oct 2023 07:07:34 +0000 (UTC) X-FDA: 81328671228.20.DDA78AD Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf15.hostedemail.com (Postfix) with ESMTP id 7D96CA0011 for ; Tue, 10 Oct 2023 07:07:30 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.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=1696921652; 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=0uwKJj99/Y8Pf2rPvldDN6ng+RGtC1wBvwQMrNRaK7o=; b=wp8QZhFxMi0kKtxNXCnLyl0Ba1fhUTn4DLR0HuR2GBQr0r7IdsHaghhplAJnv8OvCDEDOe IWGf+0dS9Kjb0RpK5bC+v1HfiVrx1eKs/eNkmGlWDixhNNZ4igkly8uekIjCkkXEdPG3ku pEA3g3rYdrS+JG5jihTZa/jq4XD8Aog= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696921652; a=rsa-sha256; cv=none; b=7ALCVu7kiXFOfBTsDIfmMdQvsipGxU3JwNSPwhLigZd8ZwVDfXXT1u3W5G7qHTiMpnSn8m jln0v+ctumU1B/5m7l7DqfiIHFsxpUGH3yhP+RHtYJdWnPYFN4wKP6sDLuAGemZKwU11t5 XGVjkRm6tuBib30bFJLGOHKL/7Cf3RY= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.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 Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S4RGC0pgcz1M9D3; Tue, 10 Oct 2023 14:44:35 +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:06 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Kefeng Wang Subject: [PATCH -next 4/7] mm: convert xchg_page_access_time to xchg_folio_access_time() Date: Tue, 10 Oct 2023 14:45:41 +0800 Message-ID: <20231010064544.4162286-5-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: 7D96CA0011 X-Rspam-User: X-Stat-Signature: fyf4dta5ggnxmqrwgftej3hitperr844 X-Rspamd-Server: rspam03 X-HE-Tag: 1696921650-818112 X-HE-Meta: U2FsdGVkX1/iNlSxEXTQB3BuHxiyFNVsrH+oqouA/YK69zcKWYtqGGaQ+cpfzmldSsUGF15B2TIoJyCsV41qHIdb1FYvXYAvM4j438QugeUC1FDXFclbKi8gKHCYvf6KzL6CAFty5bXBbGwXkYyNn0XuRP24xKqKVs4wqlaICso+ncvLBdDe9Ecok0uteVqBQnVMDFOL0uLrKTw5Q0JsGseIMAH6bb8fz1wdw4bCzqLFgYCflD4FlExw5RufHG/goDK5Mt+w69RpVOPLv5JEd9z9eeQ51rNWVmy9S7wgeJcVpTWSe8U5jePJI0F4G27pi/eQMLaJl0yyX11GGSKvThTv/aMWl98EKBZb3GsVqW53h+enGhWa3jik/J8+XVGwhjzF7JFGrrkrYFKeSVSvNVDiNAiU6aUGnmR2yJPEYFcBbL35EEo04twdpZFGl/5SC15BBymm8b3IPfBy6hL327IVA90CD8W0uuv5CJmejRb+pVQxZt+6w0LPQROOxOxh+8qukI97wNCIQZolLr6R55TEdE2WF4/YS4Ut/2QkyOsDLBQHqxWWs4g3XYgpSFDC8Gwnu06FR4cJvRTeZcUzQzV4dNaswdoH7EJ714hrrx1sWAtPI1/rcFad+kx1rQFJ7JI80rZIS09zQzLa2MrPWRkZ/paxoaoe1Z/6DNO29R3ojosRXx6Tt4MHJu+hD/XKH+3KVqmjE2jfKljufGCPgl0c9/XvqKiz9mCeYsNNxgNqkfLyXdspJ+meACILjIxvDM9crMR8PnxlBtuHUvV498ri4bPE9Y4BfOeEgnBuVQFV5XEH7evcXpPB3IU5bjLrjCS0L28gooA/uzO4qko8334dXmbcGhjsynrMiNsU0H9ySRqHDxF27mbojSrqt+WEvzo7XJhA+r2C9helf+dRL++SA4P0ao+IqoQQ4yiX1TbMsNcja+5CACIZDzQ9XCZ5o5TH8TbTpkAV7OmqGZK Go2ffSSP kM5AxYuR6WiOomL8/EhkSXDYI0NnzOdliY15QXxm+7HD0qxyBWI7xn2osNpKSOwmbwHv6UWqTvQ3jj28lQeYf7qcJyyqym+IUlXgsS8PE1ZawJnHufZvR7msO+vKE2AvjY747EeAU4t+934LFyn+BOMSN3HEsBGdrTWofBnWnmmxWCJ4vc5xqERL1HOW3HEVT+hR4 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 xchg_page_access_time to take a folio, and rename it to xchg_folio_access_time() since all callers with a folio. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 7 ++++--- kernel/sched/fair.c | 2 +- mm/huge_memory.c | 4 ++-- mm/mprotect.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index a10b8774cc6f..13ca63efacf7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1711,11 +1711,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 xchg_folio_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; } @@ -1734,7 +1735,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 xchg_folio_access_time(struct folio *folio, int time) { return 0; } diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 682067c545d1..50b9f63099fb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1722,7 +1722,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 = xchg_folio_access_time(folio, time); return (time - last_time) & PAGE_ACCESS_TIME_MASK; } diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 344c8db904e1..e85238ac1d5c 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1912,8 +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(&folio->page, - jiffies_to_msecs(jiffies)); + xchg_folio_access_time(folio, + jiffies_to_msecs(jiffies)); } /* * In case prot_numa, we are under mmap_read_lock(mm). It's critical diff --git a/mm/mprotect.c b/mm/mprotect.c index 459daa987131..1c556651888a 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -159,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(&folio->page, + xchg_folio_access_time(folio, jiffies_to_msecs(jiffies)); }