From patchwork Thu Dec 28 08:57:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13505699 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 A3E5CC3DA6E for ; Thu, 28 Dec 2023 08:58:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D3796B007D; Thu, 28 Dec 2023 03:58:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 95E566B0083; Thu, 28 Dec 2023 03:58:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C5DD6B0089; Thu, 28 Dec 2023 03:58:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 579E26B007D for ; Thu, 28 Dec 2023 03:58:07 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 34F5B120817 for ; Thu, 28 Dec 2023 08:58:07 +0000 (UTC) X-FDA: 81615625014.26.7F053B7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 8BD2AA0018 for ; Thu, 28 Dec 2023 08:58:05 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=M2TioFgH; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703753885; a=rsa-sha256; cv=none; b=fGZV7addy2N/caaH9PV5hPx2ZBQ17S4K7uT0ZfcAVJoZ0alVrUodsjYXfz7G5DE6DVnF8Y Idj+v/bpMk5uADbpvXfxV+h3Zhn7LgFI2Pko43vTlaH8hESDEkpXO+vC28a4cu/QwOfZMc yRV2j5NYuNhJ7Lm2vgP/YoNS1NEXG7s= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=M2TioFgH; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703753885; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zbMRzMXzHw9pcMkkq4R7lfUfXVXbyGf6jYLxU1701xE=; b=g33EgMeycQl/og+3Q6PAEWyUPxkcJeh+sH0VKxmFb77qe5blTptRS4zRs9tOe3DqKRvYHZ hO9JhMHTbnW6Qy3mbgWjms7ZSwz21HYg17MnFCKvlF6ztFA46tZfE15J6q1Zq3MADHzgrD QkgCKxUjzRFwNv+y3mT5pWAIPzxdKVk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=zbMRzMXzHw9pcMkkq4R7lfUfXVXbyGf6jYLxU1701xE=; b=M2TioFgHGZ/8pNJJncnnJvCyB1 h8ZowZxs4nrKjgPCZWIjHnoXSZhfy5jQTMF/yxtPMPqg0tHcijQArI/VoRn8aHYZum/QZf1APg4BX tTqSLUihyRrj+DVrc/iEE70YZaj1gqFkbjcWfnqZGfGZcrK4OAGm4m2XqBR5+wPdavBRmu9T2rKJU Lxi6Y6ZDeSeNFG5zHTFvZdNyUv1FuWD05G2KqDEhguHk/G4mag2d7WU8eRsbIGUbYWa1EALXI7klW 0bwIw6gRmM+TBvi0f00PDlQIVnDTcUQ4jDCE82z/6UVE+ByLtpXadlmcA2siH6JPXpz1YKX9tiB9G 1pw4YaKw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rImD8-004XzN-E7; Thu, 28 Dec 2023 08:57:50 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Johannes Weiner , Vlastimil Babka , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [PATCH v2 6/6] mm/memcontrol: Remove __mod_lruvec_page_state() Date: Thu, 28 Dec 2023 08:57:48 +0000 Message-Id: <20231228085748.1083901-7-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231228085748.1083901-1-willy@infradead.org> References: <20231228085748.1083901-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 8BD2AA0018 X-Stat-Signature: afnf99hu3xwtsmksfzg5ubyo1p11dea3 X-Rspam-User: X-HE-Tag: 1703753885-624441 X-HE-Meta: U2FsdGVkX18uLxOE09l3hvkFNe1GWs5LXEcYOMdyqqbr0KjQPDi9wHYo4r4uJVKgrkAuix/0L7UHVnhKW1GKTfPeYJQULxx+zhez0SzLnk+2CUVTqgrzp7K0HXCbKLKsyiQWr72zkOMX4jG5VBP/+EUbv1bl/98P7xXNfhoLgSFEGY+UG2+OcX7lG/ZKwHygyn5oPebC8egF+Ix+AvH/hRJcvWDVX28BwoQUDPaBsJLqufThBi4uhbBICKLPL99a5KgZSZ+iljxjsPRHUBZYdnxNlifaSgjYj2aEDE1Mn7VPHy5qBM4vt5PB3KxtjXesEl/GF4ZYwwnqUN6K4R4f3/46SjQ2YKQCvmzJUh2CLIPke4BLhAVLJOlgiWqmBhfY1nC9ID7gF6Br43ghoLiziFDfBN8WUL+2xFHWm6dHapvqwgrI9I5Br1G/eEZlNqZo4OQrqT5G+l/wk8S+Xs/CZ2Vblno6LohA8u6+OslBy4UeymQ+iSJW8aoym2oppzCx/7uAoogHYljC9aSMde/9f846jAJ42nZk3Vto4lERxbXDocZBUZ5yH1vYrYrjbC4QP3eLnbkisjlJsn76Gv7SCTKInbG2PD5+t+Y0VTm1mRez7T6ZcBLv9ahBpA42Wgq7tIemX9GRozC4tAsUGo42p+SCeTQQ1HmmwTn1qsczN/pvuWNoM2rxxMU2cBp6dw3orAYODpc8kbip1dvmpvIBi5gcJH9fQQOLqPVRKexvo9D4pvKHNlh2HTpba6BaG0XOOxmgkmXESlMj5F7CEv6zdFdeuCfm0/V9OeqjYwCMmKov5CFsCjcean5O01XObYvMlWPWAui3t/bkOS88C7kVaz7WTkR0GPX//CZ3lXWO9p7UIaTMs5fEIDwF5fuQy6x+VFiozyQgHawAGMllFttio1qR5qx5CNFXFSyBxG1gKSlfs3enV1ow2VzATMcHi6GYBgGEx6UA8WQyiuT1rX1 RWT7FdpG Wm6iucSzDldfZvN1a8jP5uQXnlFkzMSOJQNS5i6EoxAe7Ncs+9Opd/2g2SZaAAQZL7wXihTdrReFVN8QZhK0Ka9zCOtcsCIGUDCk9FREOMsPF6pLZFXQb3095zGRW6a23h9uQsoOkcFeh+3YMVLmkrH4Il9bU0pxaK1vRA3L6xW4MnbzBBequHkBPwRwaVKqqCpHmGGA9u4UqzaU9/bgMvt1+WrQOOt8VvOQZTzWjfGoM7IzrAmCrEYfKn+ZOuLbjqPo186rk7MjywqSXdR4lwDG44kC5615q7IhTjTY03qCAn8g= 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: List-Subscribe: List-Unsubscribe: There are no more callers of __mod_lruvec_page_state(), so convert the implementation to __lruvec_stat_mod_folio(), removing two calls to compound_head() (one explicit, one hidden inside page_memcg()). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Shakeel Butt Reviewed-by: Vlastimil Babka --- include/linux/vmstat.h | 36 ++++++++++++++++++------------------ mm/memcontrol.c | 9 ++++----- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 147ae73e0ee7..343906a98d6e 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -556,19 +556,25 @@ static inline void mod_lruvec_state(struct lruvec *lruvec, local_irq_restore(flags); } -void __mod_lruvec_page_state(struct page *page, +void __lruvec_stat_mod_folio(struct folio *folio, enum node_stat_item idx, int val); -static inline void mod_lruvec_page_state(struct page *page, +static inline void lruvec_stat_mod_folio(struct folio *folio, enum node_stat_item idx, int val) { unsigned long flags; local_irq_save(flags); - __mod_lruvec_page_state(page, idx, val); + __lruvec_stat_mod_folio(folio, idx, val); local_irq_restore(flags); } +static inline void mod_lruvec_page_state(struct page *page, + enum node_stat_item idx, int val) +{ + lruvec_stat_mod_folio(page_folio(page), idx, val); +} + #else static inline void __mod_lruvec_state(struct lruvec *lruvec, @@ -583,10 +589,16 @@ static inline void mod_lruvec_state(struct lruvec *lruvec, mod_node_page_state(lruvec_pgdat(lruvec), idx, val); } -static inline void __mod_lruvec_page_state(struct page *page, - enum node_stat_item idx, int val) +static inline void __lruvec_stat_mod_folio(struct folio *folio, + enum node_stat_item idx, int val) { - __mod_node_page_state(page_pgdat(page), idx, val); + __mod_node_page_state(folio_pgdat(folio), idx, val); +} + +static inline void lruvec_stat_mod_folio(struct folio *folio, + enum node_stat_item idx, int val) +{ + mod_node_page_state(folio_pgdat(folio), idx, val); } static inline void mod_lruvec_page_state(struct page *page, @@ -597,12 +609,6 @@ static inline void mod_lruvec_page_state(struct page *page, #endif /* CONFIG_MEMCG */ -static inline void __lruvec_stat_mod_folio(struct folio *folio, - enum node_stat_item idx, int val) -{ - __mod_lruvec_page_state(&folio->page, idx, val); -} - static inline void __lruvec_stat_add_folio(struct folio *folio, enum node_stat_item idx) { @@ -615,12 +621,6 @@ static inline void __lruvec_stat_sub_folio(struct folio *folio, __lruvec_stat_mod_folio(folio, idx, -folio_nr_pages(folio)); } -static inline void lruvec_stat_mod_folio(struct folio *folio, - enum node_stat_item idx, int val) -{ - mod_lruvec_page_state(&folio->page, idx, val); -} - static inline void lruvec_stat_add_folio(struct folio *folio, enum node_stat_item idx) { diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 36bb18d7b397..7a759554bec6 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -891,16 +891,15 @@ void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, __mod_memcg_lruvec_state(lruvec, idx, val); } -void __mod_lruvec_page_state(struct page *page, enum node_stat_item idx, +void __lruvec_stat_mod_folio(struct folio *folio, enum node_stat_item idx, int val) { - struct page *head = compound_head(page); /* rmap on tail pages */ struct mem_cgroup *memcg; - pg_data_t *pgdat = page_pgdat(page); + pg_data_t *pgdat = folio_pgdat(folio); struct lruvec *lruvec; rcu_read_lock(); - memcg = page_memcg(head); + memcg = folio_memcg(folio); /* Untracked pages have no memcg, no lruvec. Update only the node */ if (!memcg) { rcu_read_unlock(); @@ -912,7 +911,7 @@ void __mod_lruvec_page_state(struct page *page, enum node_stat_item idx, __mod_lruvec_state(lruvec, idx, val); rcu_read_unlock(); } -EXPORT_SYMBOL(__mod_lruvec_page_state); +EXPORT_SYMBOL(__lruvec_stat_mod_folio); void __mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val) {