From patchwork Fri Oct 13 08:56:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13420592 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 74DB5CDB47E for ; Fri, 13 Oct 2023 09:35:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E9E980014; Fri, 13 Oct 2023 05:35:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09A3A8D0015; Fri, 13 Oct 2023 05:35:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECAE880014; Fri, 13 Oct 2023 05:35:08 -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 DD7848D0015 for ; Fri, 13 Oct 2023 05:35:08 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AA11CB4B83 for ; Fri, 13 Oct 2023 09:35:08 +0000 (UTC) X-FDA: 81339929496.30.CCCA160 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf02.hostedemail.com (Postfix) with ESMTP id 26B0E80024 for ; Fri, 13 Oct 2023 09:35:04 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 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=1697189706; 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=BRKCX6a8tP4H8X1ue/B4mT4NUy2jX4zE7iJmytkOv34I43H1K190yZJflkCtBFw7GkV6qK 0+q9lNE7sfShCgNxH/YSR3dtimj9QrVRs3ByPWaFV+/zMQGUmrQMt0wBStwhrPy3unQDt+ BtROcyJk5kQmXDkHHulIEu6O/l9Tum0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697189706; a=rsa-sha256; cv=none; b=52y8TkGJcVSH+lJy2p7QshcTeJXI2Idl5efa+z7806mE7De/gKVG8bVNoEbk1XMH5kYlIf VwTnIhdefxIHw1svUrz2+gbnV/ac+y5FrBqE51F6sVfKBIIoZ547GCJuArj9e7V8WVnsA4 13mijl4JazAO9FRjwLjjCoJsVwuz9e8= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S6L2M48t8zrTQw; Fri, 13 Oct 2023 16:55:55 +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; Fri, 13 Oct 2023 16:58:31 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 19/19] mm: remove page_cpupid_xchg_last() Date: Fri, 13 Oct 2023 16:56:03 +0800 Message-ID: <20231013085603.1227349-20-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231013085603.1227349-1-wangkefeng.wang@huawei.com> References: <20231013085603.1227349-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 26B0E80024 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 857tuicto4xc33qdwyekr7pt88oxgjbk X-HE-Tag: 1697189704-73299 X-HE-Meta: U2FsdGVkX1/XnwDelIEp+nHzdcIE+MUqkvc1F8MLStcUxeXUZNKo0QSp6GdcBzhoV2++Svn0THz0lMLkWVUnyZ0rTA3vbo7Sg2FPfXZFWgx4A2AF7U8HOVxVEJWHPWFU/B3WsfS913XN+fN5mXOB8yK8ND5E+CULsE2UkL3qF/Qa7+7f3KRkK72yflh5l4WrUN+XH3rgj1KWYGNdkngmvb4Ou63Tjb0/8VHa/w9vvuBoE7uIYfBQrFflEHpvZmmV6+oTC6RHPzUmadyijZ9+LzI2juosBuJ8rcqgTd9oH4Sz6C+oYT7mOgTrfdsiWO8JRYtdSScL2aZ2r8lroEUJ+wZaRfy2FrEa8EL2qOu04tbLaSWuhb8wDVXXPaGb56BWyB+h+eIwOqvvsEhbffPbmxlrqn9FtJv2P95B4A2c4X1v3T9IU/EaJAmRdImGonJZQ696evKPEJknqL4a683vYMX7FUIVDjp9VOkQ8ArV9C3MCmJHN8FpXbV3lNHzAtw7m0napZk1s4M4D+eoMcJkpqPQt/7BUtcMMAMGSt/oYLD7ej1B5A5l15ejZJ/CnFKkYU5GSK6q7rK7onnjRAQWq7R+Bx/x2crqjjVdyMpaNNkAMS86JBnQJJmrCwMnrU5bX0YvxiVCX9egvJyALpl4ZACl4M9XRno7uvRckt1FN8EMPHQbFTDHExiOsM0XGFtHBuQtE2yHhfoMpbjrCSK01xtMReH7Ja0QkUv68YdhZrPg/THCgA7wX//iGxDEIZ6R154q/lw8KNQzl/D9/s1RUVH23kL/9gKbSQaNnLb3OuPkxL40Ych9jyhUj89sxUfGA0POB3PH15cmn1D1jxo+rjTA1HwFbmql+pGyiTfehHdD54yMQxWBD6zap/KWegnP8xkdQnnkT5ZvVYdUBUHfwVPPqGz2OLwrX2/OmUR6cyB7IVcxaZW58DG9GNe+oJ/g7Zx9g+gysB+k+8n34Q4 qWr1fJ5G ppjUT4PZXMPM0b7DpvhdLL4tt8tBF7FYowSCv0D/++Qx+73nsN4wrYR8uRW2CdQstODVZiSiEDYwEfEZIv+XUS0V4nj1aJgI7PL/wV0KkA2TzGWTe476/dLlBKmLVTKBhX+b/MzFIhc6KTHGABsoNLtBk9J6EgeczK3mMsd3ppPIesBVjv1pQ7Tz8ffssRhhRX16gcHQMURliGvJjmoOCxv1pwUDqUrhFxVpTqTsTNHyPCT+qZCtBvRWjqG/KZQv157xRHWxEJsT8KcAIRJM9uwSAMHjPoilinAP6 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; }