From patchwork Thu Dec 28 08:57:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13505695 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 1D1B8C3DA6E for ; Thu, 28 Dec 2023 08:58:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58D678D000A; Thu, 28 Dec 2023 03:57:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 53CE78D0009; Thu, 28 Dec 2023 03:57:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B9E58D000A; Thu, 28 Dec 2023 03:57:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 22E408D0001 for ; Thu, 28 Dec 2023 03:57:59 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E7A31C0811 for ; Thu, 28 Dec 2023 08:57:58 +0000 (UTC) X-FDA: 81615624636.06.B51AC6A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id 0A32D20003 for ; Thu, 28 Dec 2023 08:57:55 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PcKdcrVV; spf=none (imf03.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=1703753876; 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=XJHqVmT115LC4ukb52O4YlKtYYhmqN0JTST31MbrqyQ=; b=YM4eF3wHtgxUUl6DVdYGE44SrVWHR0bbiZvU+tl+O0gJjm4Qh3fRofi1j/opyhs+jOXRSv seGovEYp7ckTsRB/TXW0STYnVJ5jRveaOibXC/asYEHf80QM79iXezMu6UxXjZbaQnhIZk /c875OKFH88NVSuOvSmimbL8UhJnWh4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703753876; a=rsa-sha256; cv=none; b=WOmCaKqwln1uy3dZU5/n9pfzDVg29oI31GSWQNuPWpf3lls7G9EJptiosGzn4j8xTc202P ai0FoQQnU8aHVvvZU4gFnoUkiptIpWG/wIkOswVuuPxmL9UOtrYUkWlC97WsmE1WI0qEN/ 3fDgl3hdSZ9waH+bPMFmZ5MmxzvqzEg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PcKdcrVV; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=XJHqVmT115LC4ukb52O4YlKtYYhmqN0JTST31MbrqyQ=; b=PcKdcrVVqZHu4CYd3nHefqHtIh xhd4tLp2e1x02i0Xm6mJ1nYxZyhZmkwyQJmttiWlFmXLypPUOz4aFpe1lHEljmAK2v+4tnNFBDo5W k4z9+MN68w3KFk3qxS4Cpc8wMkZfm5zvZ1XLgJTPfkAkH+zPJ96iNq0hhFaG2ct8Pn8RtQXWH3fjP 4SNHe/HUhynWQWs9jRQy4ObD2snMkN0H3XFfDQNPeliVinwSN5ozxQTSTx9fuGU6ArPN+YmvrCNX5 oDCRyImK8t8cimVYZupj9SjG3v2xW1M19ocYeYTuVxQUKAFV9G4CFoCIlNO0fQeTP753GUNQFmCIY NfR2W4eA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rImD8-004XzC-30; 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 1/6] mm: Remove inc/dec lruvec page state functions Date: Thu, 28 Dec 2023 08:57:43 +0000 Message-Id: <20231228085748.1083901-2-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-Queue-Id: 0A32D20003 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 11r9ktz3ny9j338ez4bdehasjs6j8mtb X-HE-Tag: 1703753875-216421 X-HE-Meta: U2FsdGVkX1+y9Y3h2IaLBxK3EiN2KLNwFFYXWV2/W/do4lxtrGsx0EBgXpOZkl8eGqLydUX76lyRmBFv86tP/KUidwMZ8dyZeI+UPgQcEBXSCbifphadj5x3W0bEP09HHm9v3CWfrJV6dSoXjtOnXRgMbYBPn+8KK4ayUsukndvpbR1IDR2IkytY8eW2K+HT4gPVhUC0MnCtAM7WDJc9D734dYRdaX5DjRTxicE+4TJNGsE5hGnYDAEi6YArjecRvfn0YFkVAsTdFpQXdxVoVocjtPdRJaaFLprrnbqdxAPdlmGTmMIoJL1Qwdb0eXT/7AkDdVE11v2vO1Xqq44O7A5RXQ9kxLRRym50mwCNVNcD/XkEHjM40+sEgKr3NmCu2acHfMYD4HPA048Aho8jhsFpYv1NXW88o9F9TGacwnxkHOhNGJbpEICicAWzJo3rJNDelU+7Bjj6Yc/jdHvp8XOnR7fsha5UV1+vZCTxCLsbSDlnuI2u3DrUWZ+r6jteydx/7MO3jBAMgNc+Sf+9103ignueW48E0sZjBGgUzx0NbbytwDYuw4qUKLqv5LlBQ8o2lAaJQRVt3tdSNhlRlHJe6nq+7eCoeMRvstahVAkP+0k++a4WPUMaylDNjpqoYWwhc1tFg9VnDPY5aNqqxowT5wOngMrDTEmWMmqkdSwhsCasYw5kE++iR8IA/hRCleHqCWNOxmC7Kuca7NvzIha13SPQ5EtZR2j99LByEErboCyrZ5T9NNPJ6GHB67GQLHB3WhEoeh/yTyLzAf3X+BUlszeZWmz1t7pxxX9krQl6uBRIxy/iG0TykKB+3D8X3Lqnjhw0aHlX3T8ndtYy/klhv9XUSxf5mVStEN45Zza6tORXo1sxiknFaGR4adW8i6slaqYZKAkjugIF9CFVgWDzWUGwDmftm3yBOQd/FIQutBZ0WypaPeaDT/qgXIMtG8fmOqky5i2S/e/Sghp NfFbbiuG Yt71N1jT0nciqJQjdZBYuyfQZ5cnIjeuM3YjW+L4BrzA1bPbCogdEIaJJGQeWg0BiF4pIE2cGTzVNV5f0xGHRY7qWzm9n/qCsyy5y0KxJHgc+Lo755/W1+AKsDAcLTJRd3FEU6OHJeQu0BMzQwAd+OUN+8FmyMTNV/y4ijL14D5Z7p74UmfJoQFzbBCmBEXU2S6EMnFOsdjyT6ZS2hDhEhsTtvwfbNiHICA3DZz6E2+TL1y4N5JLXzDlCdw== 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: All callers of these have been converted to their folio equivalents. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Vlastimil Babka --- include/linux/vmstat.h | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index fed855bae6d8..147ae73e0ee7 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -597,18 +597,6 @@ static inline void mod_lruvec_page_state(struct page *page, #endif /* CONFIG_MEMCG */ -static inline void __inc_lruvec_page_state(struct page *page, - enum node_stat_item idx) -{ - __mod_lruvec_page_state(page, idx, 1); -} - -static inline void __dec_lruvec_page_state(struct page *page, - enum node_stat_item idx) -{ - __mod_lruvec_page_state(page, idx, -1); -} - static inline void __lruvec_stat_mod_folio(struct folio *folio, enum node_stat_item idx, int val) { @@ -627,18 +615,6 @@ static inline void __lruvec_stat_sub_folio(struct folio *folio, __lruvec_stat_mod_folio(folio, idx, -folio_nr_pages(folio)); } -static inline void inc_lruvec_page_state(struct page *page, - enum node_stat_item idx) -{ - mod_lruvec_page_state(page, idx, 1); -} - -static inline void dec_lruvec_page_state(struct page *page, - enum node_stat_item idx) -{ - mod_lruvec_page_state(page, idx, -1); -} - static inline void lruvec_stat_mod_folio(struct folio *folio, enum node_stat_item idx, int val) { From patchwork Thu Dec 28 08:57:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13505696 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 9A166C47073 for ; Thu, 28 Dec 2023 08:58:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79B3A8D0001; Thu, 28 Dec 2023 03:57:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F0798D000B; Thu, 28 Dec 2023 03:57:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4540A8D0001; Thu, 28 Dec 2023 03:57:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2CC558D0009 for ; Thu, 28 Dec 2023 03:57:59 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E6E581207FE for ; Thu, 28 Dec 2023 08:57:58 +0000 (UTC) X-FDA: 81615624636.09.08EE786 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id EF402100006 for ; Thu, 28 Dec 2023 08:57:56 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hYRgUCVM; spf=none (imf14.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=1703753877; 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=Z5aGVAm1tcPDUEg3vZlaI5jUIjc28IxAcvneTuOKb/c=; b=5fDHqGaP0pS/Zqc3k8DI3Ac14DKDomD0aQO+O6qvRfjKJLsBacjEnLhvqA29oiNEa26Md5 JjMyrA0rrdxyzIScJV91Ryv+I/rpfUphrVT7Nb5BvwPhkZAOWMSNfqVOJ3XHNd2PdqC504 4b/hqGcmA+gxI0Tmv+68W63pL45CyGs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703753877; a=rsa-sha256; cv=none; b=gzY04QMJF8cZ/AOw7lvPYQVsEt8g9b3bOmN/STjBZGf3RHu+2j9AHWlsexl3O0TWN2mAe4 SRaYnQEXFTJ4LiTP5voNuuzR4r+YaQ6H7G5QdaB8MG4W8LsPVjcwu6ly/8q9C18YpsISwO pr3jEF/zIoNEfoMyM98MeNcOs9Ml7ow= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hYRgUCVM; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=Z5aGVAm1tcPDUEg3vZlaI5jUIjc28IxAcvneTuOKb/c=; b=hYRgUCVMqHlrsYJf+gijvBJ2sL veeSL9+VZW6Sl93HRHg6lJvxCaOBfRNW12uBTBur4sagNAGfNCn9sGlSr5zlwfhI1T3IQPLuk7jiq AfnZvKhBZ9bzS/hT1pxhX0oIbQd1K4v353mp0nbJqPSrhQ3panp5XFvaXfAje+/6Ayi8H1tULTUmG jG+/AP4D+HNwLGckcNIttw77WvKtT8IET2DWKj19/1LwI9K64YHDLctGb/i/LX5DmhMwy8zCOHV3i V2p2k2WrNsE4rYPBUwp46D0uWJFglUgoFjvvqJbHrLZ5n24SA92Er6qkvQ4dw2w4t99d6mdv4ntS7 OKyg72Bg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rImD8-004XzE-55; 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 2/6] slub: Use alloc_pages_node() in alloc_slab_page() Date: Thu, 28 Dec 2023 08:57:44 +0000 Message-Id: <20231228085748.1083901-3-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-Queue-Id: EF402100006 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: jf5pf6aotbi89sqgnwjib7pchwtghgwf X-HE-Tag: 1703753876-359167 X-HE-Meta: U2FsdGVkX1//0mN2tUPVFIbiOrD6t9D+ly3OBZDpSa5amQjnUg93fqlrWNWrmmTVkDOUaEqHAVKgW1ESkJ6b4utVBntb+LUfIdRzplWEOKh4vosiWsv35xrnlP7PLF1SmwXT9YVUFxrfXhgxVrVKLFnaH1GyD+YsMR6wNvepMSuf4EpQBIqfUsuDOMOsbJ4//fcl08RlNASrjZh8yIM37iwLfk4kzIctgn8DxH6A1DTL/zLLrc9rfcqciENVfQo6QlOC+onyqk4VES2JApgvqUrS+Kvz9B+kLP6GHBM7Ke9a5o5F7L9tg+oDWGvarLt8D1TYpgU97R53K+GasfROAvAqUX8JyMeWQLpj4wR+ctu1IMugXI7hN8CiKhzp40ZIY9yHfAeamD84WuLwVoZs1BiiGN5KmAit7jXxiGtqCq/Kcm99RJcw1/Gl6xvZWaso/h20yjqOdi4NfGOVSoZelBPqe0GONweKGE6k61WyLtzRJqwXasefFQ1J6PmTCXnvQv/FuUThebQa/91T6AonKBRsIanQtMDuFgtj+0xoDBwy6pYCM5HVULVpEcWvBYa4BRWVbAPPzDUzHSAubf9HZGR9TP6SdRG+KfBW8kI4/5Na+yvVTc7+153P4drGZ3u4prwwzolQof1wzb9qxEPkUuB6G4v/ZWjD8F+PkK3aDlxc4JFYGrVX08x6edrCRNwNQblwGNUsIbSPRFFq1SNRuIZGInHMJSeXsFkcPgW+2qqoMjDN2mTZ952i1a4Ba5Fda2+iMCLeNxnhAYuIZtqGH8zL3SZF+lSQwQ/s13a8U5vH6uf6f9DBcYh+D+DPMcKubYwTNkbhVM/Z+7rX6zXIcNYor05EL1vn+OjPPWlSTr/8z4mTiY+tc5OJGeNl17N0O3GFu7INRbUbUdufk7quY6RYMYuZsYMd4jUJMc3KnTwk17THD2Cok9HlMPolarpNZmYo7kRUg6IOIhRJG0s wn1HSAPv 7CVVtJJJI2JqhroFcKK0CjlkZOWu8G5RIezh4citiHbpLolO7PDRGim87avBeLu6KhVzqEyeAbeWWBfX2LBis6a4/b48L3ak5EKoxJTxeQgdaEXe3Ryiz69W7a0JFYEs5hCyE6ZKS9m2+sXJqO4F9mw9lCZMua0j0S0IzHSiNeYXSMUn2bAQI/NMmNXCglo2BfUGmY5NkVjJg7hcGKQJ8S+mvPwPzbACWpIm4t7jl884sUFX0vDhEPIzJGEpeUXMyv/hhKBgpUAQlbFkrV0dc2faZs4JeqGmXrGyCPjXFKOv9eDo= 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: For no apparent reason, we were open-coding alloc_pages_node() in this function. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: David Rientjes Reviewed-by: Vlastimil Babka --- mm/slub.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 35aa706dc318..342545775df6 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2187,11 +2187,7 @@ static inline struct slab *alloc_slab_page(gfp_t flags, int node, struct slab *slab; unsigned int order = oo_order(oo); - if (node == NUMA_NO_NODE) - folio = (struct folio *)alloc_pages(flags, order); - else - folio = (struct folio *)__alloc_pages_node(node, flags, order); - + folio = (struct folio *)alloc_pages_node(node, flags, order); if (!folio) return NULL; From patchwork Thu Dec 28 08:57:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13505701 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 39C67C3DA6E for ; Thu, 28 Dec 2023 08:58:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C17E8D000E; Thu, 28 Dec 2023 03:58:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 147EF8D0009; Thu, 28 Dec 2023 03:58:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F03298D000E; Thu, 28 Dec 2023 03:58:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D50D68D0009 for ; Thu, 28 Dec 2023 03:58:12 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B5963C0200 for ; Thu, 28 Dec 2023 08:58:12 +0000 (UTC) X-FDA: 81615625224.28.2185916 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 24E5EA000A for ; Thu, 28 Dec 2023 08:58:10 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=emlQNTBY; dmarc=none; 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703753891; a=rsa-sha256; cv=none; b=APAfrOivJLYoqPy8moonF52+AsZMYZyuTaFCi53YS4Cab5xws6/YcMD8GdebliRv6g3FyV I6kaKnCIrVckw29jH+jb7ubhKrAgvz2ON7EcA2f9Zt8DuuCsiAlXQ9u3y1mWDxVNoFx5g3 bDJOhQcnW9UI/D+rMi3Mfa9jT2yHLkY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=emlQNTBY; dmarc=none; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703753891; 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=GhhQuJ3+6FTAb9vQaTHlr2F4XA41XqKfiSBVLqouEBI=; b=EmCyWVVTh8GDWmoE1Nim0Otlatp+BgJd52abii+XnzBD4S5b4yT457daq2A2YTsVd44hcg L/dIRp2qwINFKnXJZBW3oGk7PEYKKrsSKzmAR9xDVe4lSlb+LiRmCJ25oSXfP4+rdipzqc 6tUAzrTRN+mSA9hCHkP4w4Ip5X4U5qI= 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=GhhQuJ3+6FTAb9vQaTHlr2F4XA41XqKfiSBVLqouEBI=; b=emlQNTBYOwVQklEZExnp4PTDzW +YITwvtKDuaDgcvuRGwnI2sJnvHqk3pCvFi8sNadfCHDokq/ge8YGFFaPMRnWKMyXVzgnTWmu/3DY hkDZFADx9GNMRNysxvdLxLD9HzhHs/t5h1lJE4yxMLRyNlh2eLpCBRpE5JlUkm+kfVkcmm3KbWXkb tkKFvvGWv/xoU7NM3kljYopxInuTVds+H3nr+3O4+8AI0OpkhWFtlry97nYwK82NkQYS+genzYsvG KOzLr5TBgKvyA1Vn+HP0JKjYceX9n1yt8ZmLiDrj2oGB6muaXYAAaJS4G4Cp+kI6eapb47WSB2JjA PM5oXV8g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rImD8-004XzG-76; 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 3/6] slub: Use folio APIs in free_large_kmalloc() Date: Thu, 28 Dec 2023 08:57:45 +0000 Message-Id: <20231228085748.1083901-4-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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 24E5EA000A X-Stat-Signature: d4ys9goz6e3j3u57qbkbtqd9xs6wt4c6 X-HE-Tag: 1703753890-135954 X-HE-Meta: U2FsdGVkX18/6gMgF/P1aic1BKuPMVjRp6qis/DMo+FwTS6JgPU4txJ9mrHACovo4wfG3H3pTiGe1byZ7ByBbIBJy9jiaatDtVpIYyWbzHSGdXZtdoypEXlZzvNO05/PhOGPfFErD3fE7lEK6EKCIWUi5ymwsCY7+MS97epQLfhoutb40H3m9d+MsKrSn802Mzte61NFeVoPbxXejMaMB+2m+IXWkF7565h+AH22my9SNSlvf7v88iDSSmHAjpvlMwYTYOHpztMrf0PbWo/9wK5STLKVOIkk/PrJGOUPpXX8LNo47Y4/E9mjpXzzOViit7rzg2xbMpoR8a3RUurhg8HBD0fWr6JvA6Kxd8CstYUEU3NDZNUffy257+K4mwbmXscpbUn8wYekaEhSsIq1ixf3mDBfx4Xv2nmYUISTZzjbJX3gNnkP51jWykkmXHN4nPEUmWDWWDWej/XMx3bXxQFbYjuDredSQ/N9IqzWOxUXhgGwsU8eSZA5ehPyWATI4+Yt492wAqSQrD/KRjP/jSI5owDT1qtr1+LZXGNUC9CIMl3ADSxDkWLKxJys+89YKgKXxkP/vCTbLYCjVwl0afMP0s5Sb8I4+KJrgndLzs5NrybGOrPH11fIOzQ3XpHAYXOeFseU0FpQuUuYMZH0ebgNK3c4v4PVzLeEhapDI9bJrwC+S2MRlxX2TnBGwzz52jpb46iPOkogljNNmJ2Bt1U+0eYDOlf5irprNPdiK+3z/0jS1TKuBJhFH/B+pcOCbE7no8nkpXCiyZx2q/mX0gJeie0UFzjPW27Dh+ZErFxdVUctgET1j/weRoPphJkwzguFOP92ul0BSrBJ3x/eccRzZ0Q/8do7TFCKmhYuQQsKzpm+2ziHcyVK5gGVFYovDyaOlTcAok7fAE/yijv3PMThXUsFymk+9lLS6qYqY1IodM8RHx5kJ+ryXsy1nkClSEYHRh0ITXNZf8F2SNO XDtIzM0o w7a93/RsgVaAz33w2peAmb7tK0Q4971MAE8c5HJEAzQYDSBFkSVhv5t1o8ysjtAwibxGoyQsIcm/zAEdl0CIQlMscifh5GNO2a4P7bYad5u2pEetz+5T7ZVwTKl1/ugmiJMpK3Kbd/2LRZFMxnNAuVHk454QzAT18zjuambirS/yU+eCFI5bd6AeQ9dQE6Ygofb6AjA2m0Dzlet2etkbj1KXV8DNlCkX5VGP/ZHYQqk0zyeP4d5/LDLgbn2OYo/ydqJuBsWsNcJBdlBK/qYpePn58+9nEqM6YBelBsu+BsxGOWRQ= 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: Save a few calls to compound_head() by using the folio APIs directly. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: David Rientjes Reviewed-by: Vlastimil Babka --- mm/slub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 342545775df6..58b4936f2a29 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4375,9 +4375,9 @@ static void free_large_kmalloc(struct folio *folio, void *object) kasan_kfree_large(object); kmsan_kfree_large(object); - mod_lruvec_page_state(folio_page(folio, 0), NR_SLAB_UNRECLAIMABLE_B, + lruvec_stat_mod_folio(folio, NR_SLAB_UNRECLAIMABLE_B, -(PAGE_SIZE << order)); - __free_pages(folio_page(folio, 0), order); + folio_put(folio); } /** From patchwork Thu Dec 28 08:57:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13505698 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 16EF2C4706F for ; Thu, 28 Dec 2023 08:58:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4086A8D000C; Thu, 28 Dec 2023 03:58:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 38FF08D0009; Thu, 28 Dec 2023 03:58:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 231A88D000C; Thu, 28 Dec 2023 03:58:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0E34E8D0009 for ; Thu, 28 Dec 2023 03:58:04 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D0ABE80834 for ; Thu, 28 Dec 2023 08:58:03 +0000 (UTC) X-FDA: 81615624846.09.F614EF4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf30.hostedemail.com (Postfix) with ESMTP id 35E708000F for ; Thu, 28 Dec 2023 08:58:01 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=IyMUA9Iq; dmarc=none; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703753882; 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=X095FemYfRMFN93h0S2vA7H7zD93MYtAjsXIaUpVegY=; b=sm8kM+hXUBeh9EpfmLGFWiTmcoK0q9yGtNsMKVxYrQkpfiOqKfWrLO403pbYUkKrw4y87s uKZonDwmb5R9sn2R3dgT2QOyz045Mn0Iu638EQJ6G6yr1MnMCHzGlMJb5xMvOkI/qslH1u /TDS5JDC05Ylb7IjJvJ/ES6fbiby4/I= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=IyMUA9Iq; dmarc=none; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703753882; a=rsa-sha256; cv=none; b=0nMSeGO0RHSFj8w+Vrx+97CjBkn9csV9JDHxAKq7b9mK+Af0b4wbM5SCcJrxQMnbCEq6Dc Jo0Pt7wY0xZC/PppRvxPs+LiRn1HFsQjuPMb9V1OujZ6k7JmBOmj2MEXsesaynCo0S5QDf gKZTB/SRxPT17XewVKsdPwlFpHOGMMY= 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=X095FemYfRMFN93h0S2vA7H7zD93MYtAjsXIaUpVegY=; b=IyMUA9Iqr0pxq4kx39ZDc45kJ2 5Ae8PMQvE23ePTeqJQonnI14EgzC6v80AqjImBxePG9dbzs+ZgXR/Y2ZmUlPpqsTfHuUZh9cuh58S GQuoRKuCaj+M46Cj5st2WBK9WMvfH3qK42vmYfMwKF6E8ep5hCLiIt69ALTDr3CI18xt9HMwF39Ct CuQl/YHDjOaiMtVOFwLYaKYVaDfcNVoEdaC5e+ulq8S/vH16AWyaN68RTPaPXSl4rFgBwWpvMgx+S lWGP1+McII/XN3XKlV4jy+iI8SRs4HUgfXOyhXH6Y8SXmmfCV/QkVinb2Z8LaR3+7KBWzz/Qpp6Wf BMkQYS0g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rImD8-004XzJ-9D; 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 4/6] slub: Use a folio in __kmalloc_large_node Date: Thu, 28 Dec 2023 08:57:46 +0000 Message-Id: <20231228085748.1083901-5-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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 35E708000F X-Stat-Signature: 614sj93p6wompaq9qehr54y9aecgotux X-HE-Tag: 1703753881-25549 X-HE-Meta: U2FsdGVkX1/gGN7HTLXQ6yq28QmdmYvyy4MF1eDoweBzpV2o8nH7Fi1RDI2PsdnWoyh/No7nJ7fdXSmZm7myBVY6EJAwiPH+sGbb0dhRwJRS571IF3jc3l7zxaMLi8uvVKsLnJaT0PxdhroysRGdx2ZlxUyIwQDa4UwXX+5RECEtF8qnl6tfIv5c8bj8wYHtSaObHpEgCuzfbIy+2jFwIfMcDN7doj4XzFo5Qkqdd10SBkW42NAwkdHAL+4y0k0MphuWLX93pakDlXyYI9Ccb+9SRVWATsqAncgFDoTNnA4ykIbZyHraJsRCF6Q4LWIDfjCnAIvNhPt474h+/hIzpRE8hSxao0pC4puweRYgsGP2yC1T+ZegzcU0KCfbvtNVPBm6eg8BwbB9dl9GV8yMZKfoS7A76rzQ0yE6WmdOtJMDjl+d0URupuBEmtQxvcQOt1Q1LOMxBYogGVQhEivzXiDFxlcsbStb3Coc1IvwK21Kn2AZiblSRgOerkMPh5o7NePfOSlqATYjrv/NwLX8E7v5EJt1TJfVp8a64gqRyAB/ioBrIwnW6FR2OEupE8FUmP3n++Pd6pDIByW0r3vs17PrW0zFzgL2QhkjdyzvmOdHMIgraUvjVHCMfb1JmQQHsWy1svFfHVzkeaLbPqGlk0Rqcilw88LTE3Mu1WkZMr7C8cEAtXc3idT/L49ikpOUMMcil/R2Y26GNdKfp+SZC9idTL9ZGKwl21FQRR2/Ulu8pNXW7ORKogWRAlIwMTiyur28qwSzlF0WNQOHzFNRaOrVXEhHvRMp5F5Dc2X4//JNyC7JnjCZyk5wYbKsG2NrfD3uyCbjLJqhhhREQ2ZWrlCzdRN2XDhVTxqPvJZ3IBPtnn5HayDsngQ+Y0MGxCjCDrdU2rJDFZi75DKv4EvWlmFZV7Kur9k0S/ICl+TYhGYK/Zz/Fi3jMvT71AqMKTVouslgzHN04Hy/owazfnm VjjrcuQT FMwntaHkP0B9wg3I8pCOgYKt6DqqX4TO30wuuGP+ySJWJa5bXYUm6a/uYOdi+HurEKuLXYRu7Z7jCccBzB30KtKyekx4oBGTPvGW2/oY3XAhyQHhLn67NcMfr5JHOiXBQ4KWyTB3aXnSwaACUeCSwmQgpUDlbHxaFX+nQL1Kpn7BOsh6cmAB80JE6w/n1xCeWziOEfghqsA3z1Vzw7LvTT6r70H1kLUFpx1wQvfkzIoQetDfgk9buVP3/1gucup3WeZHmeMcgqh6o2m4RrgB0PcsyEWdsBmZ3YEnmZhqk9/DAnR4= 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: Mirror the code in free_large_kmalloc() and alloc_pages_node() and use a folio directly. Avoid the use of folio_alloc() as that will set up an rmappable folio which we do not want here. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: David Rientjes Reviewed-by: Vlastimil Babka --- mm/slub.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 58b4936f2a29..71d5840de65d 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3915,7 +3915,7 @@ EXPORT_SYMBOL(kmem_cache_alloc_node); */ static void *__kmalloc_large_node(size_t size, gfp_t flags, int node) { - struct page *page; + struct folio *folio; void *ptr = NULL; unsigned int order = get_order(size); @@ -3923,10 +3923,10 @@ static void *__kmalloc_large_node(size_t size, gfp_t flags, int node) flags = kmalloc_fix_flags(flags); flags |= __GFP_COMP; - page = alloc_pages_node(node, flags, order); - if (page) { - ptr = page_address(page); - mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, + folio = (struct folio *)alloc_pages_node(node, flags, order); + if (folio) { + ptr = folio_address(folio); + lruvec_stat_mod_folio(folio, NR_SLAB_UNRECLAIMABLE_B, PAGE_SIZE << order); } From patchwork Thu Dec 28 08:57:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13505700 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 0A0FFC4706F for ; Thu, 28 Dec 2023 08:58:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7143F8D000D; Thu, 28 Dec 2023 03:58:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C4D38D0009; Thu, 28 Dec 2023 03:58:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5185B8D000D; Thu, 28 Dec 2023 03:58:10 -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 357E68D0009 for ; Thu, 28 Dec 2023 03:58:10 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 15DA7A1B98 for ; Thu, 28 Dec 2023 08:58:10 +0000 (UTC) X-FDA: 81615625140.10.9722D26 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id 770ACC000D for ; Thu, 28 Dec 2023 08:58:08 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=G5aowaOV; spf=none (imf10.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=1703753888; 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=NccTglOgefcrO3rZHgTRFfPB5Ozz6huMlwZ2e954KZQ=; b=qq6toJgeJkdr/5JghJ29GuO+I4LJuHGsuPSOYf2lO/zR3xnCkbQ3eEtpJqg3aFgEKgGWsi uLkq6/3kBIbwed2yMrFZbTdqO34Al2wdad5SR0jL+ku2X5bVQKl6uMcb4NoxxpqtrYNhLK IoKyP/DNSVRhUetEsMsJJREji82omtw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703753888; a=rsa-sha256; cv=none; b=SSEnWlrE2N9rlYcjqIzU3yMjyYSoMGlSjIgkm4YrqvuuWkinwDwxlZnLP9KGR5Kko9epia 69ryBocw+HFY1E93FzU74bsUlFS37ppg9gw1Ix38+7wDGjSSJP/hARvlHJy0kw7AFERW/r 6QWsTkYPWc6elBFMO+Vg14iaQvb4Oes= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=G5aowaOV; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=NccTglOgefcrO3rZHgTRFfPB5Ozz6huMlwZ2e954KZQ=; b=G5aowaOV0KLhgOuqCTkb1hlJOk RvQzczRTVSQtwowJqZM+eUNsoeJLlgKEYY/Y+7fGf5Z3LIn1m8HHq2eA6NZNhJqI8aiFCRBQWPk8Q HCmMc7zmIyFDcfGVQOpjH52ByMuB8hbEt66p+1v/Ffc8YSpMhm8vpWIzgcakXB0jYRTdbS2ekQVUU PEij/jgqmGmcmanta4uOpb/BHMHJRcP5kHzeWCZ3HbwJpek7hsH5q+D19+XgGtRRv9wOCHCZfqAtC LoDiFqT5i0K0hxyt2NoGPjMSMmijQc2HtCGutu9TIwx9iohOcSRVyT8yDTTJLaGsyMaUOmlSYUOht b1/LWy8Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rImD8-004XzL-BP; 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 5/6] mm/khugepaged: Use a folio more in collapse_file() Date: Thu, 28 Dec 2023 08:57:47 +0000 Message-Id: <20231228085748.1083901-6-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-Queue-Id: 770ACC000D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: yuimerjababkgcxq345r41ibaex9bced X-HE-Tag: 1703753888-542947 X-HE-Meta: U2FsdGVkX1+JCHtwPjZs16o6tlHYSacqnnJdv35oTE+4l3LOJoGHQw4S6m8D+wIFA20KB/UzOkpq2lcuuQVhqdsoe3Y6bR6D2pmPJvqE2XIKtK4XRx2/E3ajHcxEHWHAb0I9ofG7y+cO3DdSFuV+8eXTmkpFlQGcC8mLEF0E4ZmtUF/Y/9DcIg19CUshoYhRIqvy+CU//8Y16UuIaBBVDIlu9YPeMlrrjuVmw9rLA/dMm/SR0jo4ztFSWqGOGGK3ATMHFNWb6dtzdGbeE/7oUx6G3LEjrXH9xN3LnbYEIvLL8Q6E4YYm0vaicMAbyLOYlklnsM0PbJLfqUzTsK71AVrliPcSW6jgnRhXiwiIKtuu13RhFB270iLCq5FDXS5yXSxh+gm95ErApRacbqAQATbeR81UR0ozb+OM7wwrZeLHFlSSYXmNvMfC/Tt+Cj2Cqns9/RiXWrtxUKdNxViyno9CoKJWvZKuDyHFxqKQD68uOxZ8rANhIM8i/3Jv6eHV5GTvWY6e0aHiFVCDn0IxUhCUeuXie0wDJWug0GFIq6Q90ESuQaruloRTk52XaPrZ0A2cvVuh7ww9P7uTNkEZ02xkHrf7/K0o0ZvAZ769cBHa5iFJsFIuol/rRodtV1E/JsnKPDpOUGXnvCOpyaR+31Rgpacj9OfIYvg9KWBsSNwQtBgtfn1CrojaeLVL0e451L9sKkLFcEUTaLIPk7qA/wNI7pVw58AVzPG1ByPlWy8y/YF4NE2Y8FLvrPqdyq3Vd5/3iPRRJSY08zRKzO2+aqYJMXnQ538tvL7NWSkkAx/ZbpFu/+U/8isOPGGPBkGeJmVW90VPnGjuZ8/7zZhJb/df/Gsnee2p0NgAsPv1KuDLgvQpsvyvpTcshIE4GxLXPNjXa85jO4KcRE8JnlSNKF2nqPHi7Dd3VWHpTYcVGHuIMya1vGxdtYOMLaxgxeiBqy5oCrx3sdicKFb1bgM 95a08Iw3 r3gsKnDfjGelW0KrNQGvLt4nTNgJ/DSnWk35cf3jWOnOKjVz9KY6zuz+6bD1mkvvQkEw0Qta9iWWwTS4tEmBSRFUkIGMg3dY+f9mbauxae+9EsYwhF3SjKxDPvSipiFqgQ9iNlQeOqFbyspmoOHwnEdndZvbOM+jZEsvoco6AFYTcZawafvRJCx9B8J/gcKroLhXBG5nUZ68l5UyJBbUoM+NNOnBVFks62In5khytTdIwNJVEUnxy5E8QMO1D5MPS4p8g0GoLcNh+6X0UH4ijZP6lXI1XN5WC69NHB9VOdjYAZJs= 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: This function is not yet fully converted to the folio API, but this removes a few uses of old APIs. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Vlastimil Babka --- mm/khugepaged.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 13c6eadbeda3..b9b0742e4d9a 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2126,23 +2126,23 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, xas_lock_irq(&xas); } - nr = thp_nr_pages(hpage); + folio = page_folio(hpage); + nr = folio_nr_pages(folio); if (is_shmem) - __mod_lruvec_page_state(hpage, NR_SHMEM_THPS, nr); + __lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, nr); else - __mod_lruvec_page_state(hpage, NR_FILE_THPS, nr); + __lruvec_stat_mod_folio(folio, NR_FILE_THPS, nr); if (nr_none) { - __mod_lruvec_page_state(hpage, NR_FILE_PAGES, nr_none); + __lruvec_stat_mod_folio(folio, NR_FILE_PAGES, nr_none); /* nr_none is always 0 for non-shmem. */ - __mod_lruvec_page_state(hpage, NR_SHMEM, nr_none); + __lruvec_stat_mod_folio(folio, NR_SHMEM, nr_none); } /* * Mark hpage as uptodate before inserting it into the page cache so * that it isn't mistaken for an fallocated but unwritten page. */ - folio = page_folio(hpage); folio_mark_uptodate(folio); folio_ref_add(folio, HPAGE_PMD_NR - 1); @@ -2152,7 +2152,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, /* Join all the small entries into a single multi-index entry. */ xas_set_order(&xas, start, HPAGE_PMD_ORDER); - xas_store(&xas, hpage); + xas_store(&xas, folio); WARN_ON_ONCE(xas_error(&xas)); xas_unlock_irq(&xas); @@ -2163,7 +2163,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, retract_page_tables(mapping, start); if (cc && !cc->is_khugepaged) result = SCAN_PTE_MAPPED_HUGEPAGE; - unlock_page(hpage); + folio_unlock(folio); /* * The collapse has succeeded, so free the old pages. 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) {