From patchwork Tue Sep 26 00:52:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13398589 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 4C450E6FE31 for ; Tue, 26 Sep 2023 00:53:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E546F8D005C; Mon, 25 Sep 2023 20:53:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E047A8D0005; Mon, 25 Sep 2023 20:53:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF37A8D005C; Mon, 25 Sep 2023 20:53:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C22148D0005 for ; Mon, 25 Sep 2023 20:53:33 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9472DB4078 for ; Tue, 26 Sep 2023 00:53:33 +0000 (UTC) X-FDA: 81276925506.30.E8427DE Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf25.hostedemail.com (Postfix) with ESMTP id 29DADA0007 for ; Tue, 26 Sep 2023 00:53:30 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 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=1695689611; 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=1NMXgpblLezaPosE82Jei/cXHdbr/hhXwa/WKnoyZJg=; b=eLSJzYaeLQGmpCec5FakZs4be5wQpxdzXoWeuvQ4WaZhKWu++1IF3RPhKa76Ij8e8QaNmc +SlcDOmjIUKegkA4q+oNO8S1uUR45h2cGnA4vzGWNzEzReuusFDQ0G/mmzvJI1C+mrd0BO THuLZabc80ZsYrOnofmtUlDtEzYd2lw= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695689611; a=rsa-sha256; cv=none; b=GoK9Xx8huq31LpdPj1tN9p09IBsV0Y/1w3tf1bZ+DOLNl9221BPVScPnzUh7UgkuO4++I4 wzL4ESiSWQN0Uz4SxjeepzCAjD1u8atX2w3uqrnam3RwjZ/ig2r0e0DX2F7cW2E9dYmMtg Ga5MnySy/645y4h6vajnPLH8F34H66E= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rvh2n28SpzNnv8; Tue, 26 Sep 2023 08:49:21 +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:09 +0800 From: Kefeng Wang To: Andrew Morton CC: Mike Rapoport , Matthew Wilcox , David Hildenbrand , , , , Zi Yan , Kefeng Wang Subject: [PATCH -next 4/9] mm: convert xchg_page_access_time to xchg_folio_access_time() Date: Tue, 26 Sep 2023 08:52:49 +0800 Message-ID: <20230926005254.2861577-5-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: krcp4zxse7rb4xbj91phkm6ixdza4iw8 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 29DADA0007 X-HE-Tag: 1695689610-246513 X-HE-Meta: U2FsdGVkX1/WBIW9miRxfGAEEv0hFarUqsp9WeUQ9bjPz31MsG0xabEusOcVAXJW4CnTJ5i9nW4U02F51txdWvtjjS73lHtDWBFj7VmCUpai+JdavgJ/ofrwMh5at/Lin+yTsY633Qnls1om9b0IrxsNIM2/qfEvth8aZepDJTzKcUwF4l6OGHYg0EV2mp8uXRZfIww317iENb9s2s8j8vc5keG8iXhW60PZJv4w7dmz8zCuifBRC+F5MOIjWgyfU/lmMNZEj/fkRn+B2FsCT68Uu8EtuNxxhdd9dOIxegZDDnusMf5iEdW76MQNZ4/cWVnrgENWindfFOcdYyDWogBUX4oU9y2VFLKnFBnXTRICakCAQLySbeEJZ4tLjUweEx5xgxF52NJKggR8uxe84F4WPy9bMkBbZXehvqr97btWsoEX1AIXyD8Wunt50069oYk4Sxf/lxsS/WCrs0ZTDxfLsubJ0ZvePQrQBsE3/vw820GZA5nUsnnpYRw78IqPIMkgKu1rvxpslFLLQbFJ325GGeD1nEn5qEZkNBWqVIHy3QKJ6xw8Fb+O/cbbcX+Lo2SVfruIlZDE1XVxB30QP0WTe++bWqsq1GzE4P9wdnJbqqj09WWkcnDoXqciofU3SkEzRK05g0lFAGdENjK8U0Lg+6xYAFisUCjTmbuXPq4JE/1Wvr4NyR2NfueX1T7sZK3SzUcP+o27hChg7tJBcBNY3J98sZlJi8JdK4kn/+XXvxNL/1JLp6uvL4SHOEZscV0PexpGnbAoHigBmnWtgk5kvmB3aK37WzCiF1ohMBfnGvuh0vUvPavJIHDZFaIl7oPsAIGowLqtGz9Ym/2Ygj5lZvA7hD63uBoGOVePythVz28VxpL2rIMCpT1qaIE+SrP0TrDx0dUoXv5GEShgUcAzTtmgtdjnVPUhC0aYYxFoblQW6wLnLuPeJuEZenFtRmh7XRWiltqQNLaduqG srlCAWol MssIOfiuwD1rYD3lSrbucxSJkpUT98J7APQhyc848CEGM18lWsE8d2cRKXrizVoc04xYk5UeH68RYRJLrtbfTjt+jrJf19bLmqC3/R5/0VcI+SpcMyuY+jasDrIMtckkKah9W8H73OEamu6noNZpyLBm3Y2ROI6jM0BODxFSmIJlwTtBu71pdYWpzpCzXa1vUK7ZQ 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 a1d0c82ac9a7..49b9fa383e7d 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 b507ec29e1e1..afb9dc98a8ee 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1714,7 +1714,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 c7efa214add8..c4f4951615fd 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1905,8 +1905,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)); }