From patchwork Wed Dec 1 18:14:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 12650781 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 8C85CC433FE for ; Wed, 1 Dec 2021 18:33:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 222DB6B0074; Wed, 1 Dec 2021 13:22:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F9986B0073; Wed, 1 Dec 2021 13:22:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F00466B007D; Wed, 1 Dec 2021 13:22:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id D86106B0073 for ; Wed, 1 Dec 2021 13:22:09 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A391D181251B9 for ; Wed, 1 Dec 2021 18:21:59 +0000 (UTC) X-FDA: 78870044358.20.08B63E1 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf27.hostedemail.com (Postfix) with ESMTP id 13CCD7000091 for ; Wed, 1 Dec 2021 18:21:58 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BB5A1218B2; Wed, 1 Dec 2021 18:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1638382517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uWOTlxFmef0oGs2stQSS0Rsd2cxbVvDDqKeEkd3BcJ4=; b=hde6vCSOPLaGFMRjOeN4ZnNwki5UfUXlShRBoCTB+Iuvav84YYD67q0QAGLcMIJxJLGxUX 2KVZfV/sa4MlH3z9jYbpBtf3E7mLnyR9JzknbOhGJhcW+aDEwV6x/BRsuJgiT5GMw5qkvE oGTvXrEvaRy9Q4rsMbPhsOhgUrUoaVw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1638382517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uWOTlxFmef0oGs2stQSS0Rsd2cxbVvDDqKeEkd3BcJ4=; b=HxoWw1nmC1F+Tep4pS9PdDL4WJPC8w4b6T4xHSwdBMeVtOYe7n+vYK/lLlkvdqvcgZFF+/ 3jN841WomPoN4GCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 935D414050; Wed, 1 Dec 2021 18:15:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UIZHI7W7p2HPSAAAMHmgww (envelope-from ); Wed, 01 Dec 2021 18:15:17 +0000 From: Vlastimil Babka To: Matthew Wilcox , Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg Cc: linux-mm@kvack.org, Andrew Morton , patches@lists.linux.dev, Vlastimil Babka Subject: [PATCH v2 15/33] mm/slub: Convert __free_slab() to use struct slab Date: Wed, 1 Dec 2021 19:14:52 +0100 Message-Id: <20211201181510.18784-16-vbabka@suse.cz> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211201181510.18784-1-vbabka@suse.cz> References: <20211201181510.18784-1-vbabka@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2460; h=from:subject; bh=geJJNEx28YZrRr5Wvloi9v4Zgqxi1u8ijlEq0D6QbzY=; b=owEBbQGS/pANAwAIAeAhynPxiakQAcsmYgBhp7t/teQXdQhfId8DCGJ7rBvvdQonM8sqbgwhAHYm 4c3x8kiJATMEAAEIAB0WIQSNS5MBqTXjGL5IXszgIcpz8YmpEAUCYae7fwAKCRDgIcpz8YmpEKBHB/ 4gbJ4kyIKLr3x+NRnCHh4NvLBA2K9DqB1KHDmZ2OJehAEhMQxCmRDDD9eclrKO0HDT0z01ccb1K2nj M8fVT308mcc2GXkA76VuNYUiDBCjLrwHQFmuyLNOjQwY7b/0d6mC4IgilahAwncqrj49m7lPXA6Azq KIV2JNXXS5AeAGmiomFDDBjXVPEL9tB3R8GiMxEMheaglvBMzdfg+Y+UWS8qZwmck8yzP3389JA9dd J0lPpchJkTla2pOgjVyHnbEsM6KZJIZrv9e9a8SdZj0Aid1ezZ+SOaC4dOJQ8h6AV/Zcy2nMsQSBGT GT6W+QTEF8PFCMDxuF9+2DOr1BjIsH X-Developer-Key: i=vbabka@suse.cz; a=openpgp; fpr=A940D434992C2E8E99103D50224FA7E7CC82A664 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 13CCD7000091 X-Stat-Signature: hshdzj15dw7iithzjtfrigapz7t67h54 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=hde6vCSO; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=HxoWw1nm; spf=pass (imf27.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-HE-Tag: 1638382918-122354 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: __free_slab() is on the boundary of distinguishing struct slab and struct page so start with struct slab but convert to folio for working with flags and folio_page() to call functions that require struct page. Signed-off-by: Vlastimil Babka --- mm/slub.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 3d82e8e0fc2b..daa5c5b605d6 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2005,35 +2005,35 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node); } -static void __free_slab(struct kmem_cache *s, struct page *page) +static void __free_slab(struct kmem_cache *s, struct slab *slab) { - int order = compound_order(page); + struct folio *folio = slab_folio(slab); + int order = folio_order(folio); int pages = 1 << order; if (kmem_cache_debug_flags(s, SLAB_CONSISTENCY_CHECKS)) { void *p; - slab_pad_check(s, page); - for_each_object(p, s, page_address(page), - page->objects) - check_object(s, page, p, SLUB_RED_INACTIVE); + slab_pad_check(s, folio_page(folio, 0)); + for_each_object(p, s, slab_address(slab), slab->objects) + check_object(s, folio_page(folio, 0), p, SLUB_RED_INACTIVE); } - __ClearPageSlabPfmemalloc(page); - __ClearPageSlab(page); + __slab_clear_pfmemalloc(slab); + __folio_clear_slab(folio); /* In union with page->mapping where page allocator expects NULL */ - page->slab_cache = NULL; + slab->slab_cache = NULL; if (current->reclaim_state) current->reclaim_state->reclaimed_slab += pages; - unaccount_slab(page_slab(page), order, s); - __free_pages(page, order); + unaccount_slab(slab, order, s); + __free_pages(folio_page(folio, 0), order); } static void rcu_free_slab(struct rcu_head *h) { struct page *page = container_of(h, struct page, rcu_head); - __free_slab(page->slab_cache, page); + __free_slab(page->slab_cache, page_slab(page)); } static void free_slab(struct kmem_cache *s, struct page *page) @@ -2041,7 +2041,7 @@ static void free_slab(struct kmem_cache *s, struct page *page) if (unlikely(s->flags & SLAB_TYPESAFE_BY_RCU)) { call_rcu(&page->rcu_head, rcu_free_slab); } else - __free_slab(s, page); + __free_slab(s, page_slab(page)); } static void discard_slab(struct kmem_cache *s, struct page *page)