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: 144658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1590534vqu; Mon, 25 Sep 2023 17:56:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkkm7E6EVsJeRCCcnWPSPnIcIrLVKVBYpjW87RuD/Qutq2xfFUTrNCyrrDA5M2aKcW75O3 X-Received: by 2002:a05:6a20:7d96:b0:15d:6fd3:8e8c with SMTP id v22-20020a056a207d9600b0015d6fd38e8cmr6726842pzj.14.1695689781278; Mon, 25 Sep 2023 17:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695689781; cv=none; d=google.com; s=arc-20160816; b=uOBQNFCtgv4AxOiSBouY5/Qjcof3yMjM7gX7w1rSBVJu/XzyixrPnDcQkKKkns4ckA ooWt6gvadpEBvYLDp0lIJdEpMnsVLJg9VC4WMKwkNzqJWUjONWkI6scboFPFBkOS3Gnf xFH+IaygD8oaVss9Qz5yLIn7eCD/Cu35kZwtfThn8W++DWoWEuaRyePrvQ0cI2dPAUty +ARcw21k5ioShLAaUSndJbPUQk/8UVmv2rLSaq1ad7zPWJ9+ChtyzFMH3W79mCFKW554 koCXWrtLg4lJvag6f5x9D2JGKQq7nSztzHs5sisn3JnZ0QT2v8xIz155jZu4pn1aFbsG 9c+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1NMXgpblLezaPosE82Jei/cXHdbr/hhXwa/WKnoyZJg=; fh=FiTqiBStz9H28Qh/9rW0myzOFac7M9VOPFJTunt8oTE=; b=RPZkPq2RIAV1gmtHRzb2aTzg7VRL4YizvJTbLXrm3yU2VwuSOCCIbWa8yTKFiDnbOq ZTvYoQppnfZh83MjRKR2s2DMB5JP7Pi9vFIE5j/j3HAlJBCOy6Ni1tAOIbUjE4YpCHco bqvayIpaxmfvcqpCkzRhoTqPNaflNRgOhsH3W5EoY8hbe7R2AbdJBkVExD9MbhivL8ze QVrZWfv3WWd9PupuMkp5BbYX2nhLozngckzt0lG82GSIZcGiOAXwRM1I0ZPLaurun71c BWWHa3TydS1sV6LkSI+Q6rvRJpaAJkZOsinVJo37FoLWW+AfchcU/UBcZgLH9Dn8PYU6 tYCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u7-20020a170902e5c700b001c6189eaadesi4149658plf.132.2023.09.25.17.56.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 17:56:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CE86A8251703; Mon, 25 Sep 2023 17:53:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233001AbjIZAxc (ORCPT + 27 others); Mon, 25 Sep 2023 20:53:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbjIZAxS (ORCPT ); Mon, 25 Sep 2023 20:53:18 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15B7E116 for ; Mon, 25 Sep 2023 17:53:12 -0700 (PDT) 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-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 17:53:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778059608478227570 X-GMAIL-MSGID: 1778059608478227570 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)); }