From patchwork Wed Oct 18 14:08:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13427173 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 F292BCDB482 for ; Wed, 18 Oct 2023 14:28:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CA8080017; Wed, 18 Oct 2023 10:28:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 87B5E8D0016; Wed, 18 Oct 2023 10:28:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 768E480017; Wed, 18 Oct 2023 10:28:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 621378D0016 for ; Wed, 18 Oct 2023 10:28:28 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2A1E21CBBD0 for ; Wed, 18 Oct 2023 14:28:28 +0000 (UTC) X-FDA: 81358812696.26.8E31699 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf04.hostedemail.com (Postfix) with ESMTP id 67C2040010 for ; Wed, 18 Oct 2023 14:28:23 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.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=1697639305; 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=KMKcdjwd08Xk8ND6ULlLoLx+XBYNhLeLKyS742C9v9I=; b=KQuSJCu2GYgH0O9vuio1DYHC46CKsV8/mwJ66qaQVy/38tluZDAkhxjN48VHwG/1WmNUtH WZoIV8aStsqQpZFYtuRuYPJGlm/Q80sBlIJ2QrlK2ZiahhkxUfiS2QSK+hMQkS6/Oj1sbh HZ1BLYWN/5cBOBqzszZGy6WZBuHFvcI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.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=1697639305; a=rsa-sha256; cv=none; b=IFJpJ+QEsWPERVYhZEfvFf4xz2NBN4tFEEMZP9AwE+A30RE8STBw7pqklpJlfv6PcumAMx 4EC+t1ruk4HTabMxKN6YSpqKMKPRCk4o8MoqiNyT8y9SY4eZVrrcz2qnNymRKvQeiKXlxJ kZpgb+C3SSarQfRDCXJznT6LnjXBRHI= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S9XgG2pm6zRt5M; Wed, 18 Oct 2023 22:05:30 +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; Wed, 18 Oct 2023 22:09:10 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 19/19] mm: remove page_cpupid_xchg_last() Date: Wed, 18 Oct 2023 22:08:06 +0800 Message-ID: <20231018140806.2783514-20-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 67C2040010 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: t3icra7pyaheyh7pki5ycc9s17ron8gp X-HE-Tag: 1697639303-719073 X-HE-Meta: U2FsdGVkX1/RdsSiXclF7GBpgF22IzdudS3JzwzJtKffUIkSDpqmrY0S4OvyI4/0xxk/sHgJnHJ24kz6Tn6OoepKBkXaLX9fPiNmpP2rf57BZZ/wW5fxQc+3q7u6tCi0qVEchYr1y8DDZvv8ynGUD0aDIHL+RnYrD/7h46a+e5O/pBOtLwL9QIKNk7b9FvbfC+Tqu1Cu6Y0LCAEs1eBJi50RNcmbLIKPi+wK6/5TbZz/vT3ZE0Mgj66w31LsoogHZ6Z/OdA+i2ecvwodxvGYcDa1KuCMo1Y+sRUk+OG8nrhRjfRR2HyqOAuzB5R0r+VvAvsNsLy+SwJ6gwR1asA15zUFqc6fT/3RjMew01KgQCxcUlccL/howyxUKfKgjE6bBcMOhXID+C5GbgggK/oawGga+jTOqSNTPHCix+iTMGOD+ilyOl2Qlk+nBYeaL26PDoDmjJzwSbm6NE1Vjnid/hx/AvThsouD+yQcd2+sfjTH+xeEjM4yC8EadZMIInoMujrmveWWKlc1M4ZdORaZMIhcv/1Jn9IwKbwhtZJv9Vpx1Uyq3pjrGdzV8WHjDta9XXp060F7tsBecmHXAYg4UBwo/L2ovHnGpOpcGibdwEX4co6UxK9EvrX2YBS1cDYySfEg0hWVqyVIQg4rIZBga12ATkz7n16B69ajIhIdcpbV3EEOWaWr3z9229FN69m8uq0KxJRbclb/rwl/pXMYc74V+idtDeWPQ5MlpSOLaj6hcsCBsC1M8IPaPtVbdub0fDyDxEvqFd07fATegsIIayyo+gVH5dr7asu1FqGngIwF90w4nPS0cZNGg5iLGqFnZ1440/TSOffZWL8l/R0JN3hEw8pq6Z3FNHr8GLXsHRCdGcUVMfRmLQ/yt6VOF9Hoy+/S1Psk0flWNibIV91P3PhKFJSM6b4uTuj/zvJKmkW0w0rOi9pEoSPlmngvpWxH+bkM+B03RkOK04yRlm/ uKnhgO8h m4GFNuNtOfKgX/v9t75aTywplmKe/i4w4uZeSRRYgRlmu7d0K9BBWbZFjbNTzLmiu5WMW2Rgny+UZrbIHBXdD5HPkJs1kkW1emxAzW3sa5uHPFzeKV7TlESFzanEogDt2GZy4zWDzpf24+GRxjn2KRSmM9qrFSQBKLvONBgUhfMh+yQDxHc+QB0ZBbZ3hhAWvU1Js 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: Since all calls use folio_xchg_last_cpupid(), remove page_cpupid_xchg_last(). Signed-off-by: Kefeng Wang --- include/linux/mm.h | 19 +++++++------------ mm/mmzone.c | 6 +++--- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 70eae2e7d5e5..287d52ace444 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1694,9 +1694,9 @@ static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid) #define cpupid_match_pid(task, cpupid) __cpupid_match_pid(task->pid, cpupid) #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS -static inline int page_cpupid_xchg_last(struct page *page, int cpupid) +static inline int folio_xchg_last_cpupid(struct folio *folio, int cpupid) { - return xchg(&page->_last_cpupid, cpupid & LAST_CPUPID_MASK); + return xchg(&folio->_last_cpupid, cpupid & LAST_CPUPID_MASK); } static inline int folio_last_cpupid(struct folio *folio) @@ -1713,7 +1713,7 @@ static inline int folio_last_cpupid(struct folio *folio) return (folio->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK; } -extern int page_cpupid_xchg_last(struct page *page, int cpupid); +int folio_xchg_last_cpupid(struct folio *folio, int cpupid); static inline void page_cpupid_reset_last(struct page *page) { @@ -1725,8 +1725,8 @@ static inline int folio_xchg_access_time(struct folio *folio, int time) { int last_time; - last_time = page_cpupid_xchg_last(&folio->page, - time >> PAGE_ACCESS_TIME_BUCKETS); + last_time = folio_xchg_last_cpupid(folio, + time >> PAGE_ACCESS_TIME_BUCKETS); return last_time << PAGE_ACCESS_TIME_BUCKETS; } @@ -1740,9 +1740,9 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } } #else /* !CONFIG_NUMA_BALANCING */ -static inline int page_cpupid_xchg_last(struct page *page, int cpupid) +static inline int folio_xchg_last_cpupid(struct folio *folio, int cpupid) { - return page_to_nid(page); /* XXX */ + return folio_nid(folio); /* XXX */ } static inline int folio_xchg_access_time(struct folio *folio, int time) @@ -1794,11 +1794,6 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ -static inline int folio_xchg_last_cpupid(struct folio *folio, int cpupid) -{ - return page_cpupid_xchg_last(&folio->page, cpupid); -} - #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) /* diff --git a/mm/mmzone.c b/mm/mmzone.c index 68e1511be12d..b594d3f268fe 100644 --- a/mm/mmzone.c +++ b/mm/mmzone.c @@ -93,19 +93,19 @@ void lruvec_init(struct lruvec *lruvec) } #if defined(CONFIG_NUMA_BALANCING) && !defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) -int page_cpupid_xchg_last(struct page *page, int cpupid) +int folio_xchg_last_cpupid(struct folio *folio, int cpupid) { unsigned long old_flags, flags; int last_cpupid; - old_flags = READ_ONCE(page->flags); + old_flags = READ_ONCE(folio->flags); do { flags = old_flags; last_cpupid = (flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK; flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT); flags |= (cpupid & LAST_CPUPID_MASK) << LAST_CPUPID_PGSHIFT; - } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); + } while (unlikely(!try_cmpxchg(&folio->flags, &old_flags, flags))); return last_cpupid; }