From patchwork Tue Nov 16 00:16:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 12620693 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B262C433FE for ; Tue, 16 Nov 2021 00:16:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D344263215 for ; Tue, 16 Nov 2021 00:16:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D344263215 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 45CFC6B0087; Mon, 15 Nov 2021 19:16:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 12F496B008A; Mon, 15 Nov 2021 19:16:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD2456B0088; Mon, 15 Nov 2021 19:16:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id B2B0D6B0087 for ; Mon, 15 Nov 2021 19:16:41 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5FEE11815582C for ; Tue, 16 Nov 2021 00:16:41 +0000 (UTC) X-FDA: 78812877402.06.9903052 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf01.hostedemail.com (Postfix) with ESMTP id D4C595092A17 for ; Tue, 16 Nov 2021 00:16:23 +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-out2.suse.de (Postfix) with ESMTPS id 1ED171FD6D; Tue, 16 Nov 2021 00:16:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1637021799; 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=AWRQvetEuXyxvNXmkWd8fwtYl9etsz6fuvLreoSrYe8=; b=0FYGsXL8FVPnxJuMQ9eX0VC/x5QKcvWVWweSs62OqesYDkBpe5HdV6kK7tM+1KKKYC7KCp jnBmTidOvXVjavN3dOam3vo9Ua0GMhB5mFdQSNAmocGfDuea/zD5FfBFRahb2mKchwL1Ma a1jDxGulZLDQczCf/7ehZrxbzUWYHrU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1637021799; 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=AWRQvetEuXyxvNXmkWd8fwtYl9etsz6fuvLreoSrYe8=; b=k/gGi2FONlYUlFJFLRpbsY8gwCyBZA2drCSaZpY84G/eMopD06XqcfdHvyR/IWvyDsol+p XaWtypdFePFBXDAg== 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 01182139DB; Tue, 16 Nov 2021 00:16:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SIgmO2b4kmFjXAAAMHmgww (envelope-from ); Tue, 16 Nov 2021 00:16:38 +0000 From: Vlastimil Babka To: Matthew Wilcox , linux-mm@kvack.org, Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg Cc: Vlastimil Babka Subject: [RFC PATCH 14/32] mm/slub: Convert __free_slab() to use struct slab Date: Tue, 16 Nov 2021 01:16:10 +0100 Message-Id: <20211116001628.24216-15-vbabka@suse.cz> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211116001628.24216-1-vbabka@suse.cz> References: <20211116001628.24216-1-vbabka@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2460; h=from:subject; bh=VENRwUMVNE51ElmjCJYoTxZ5e6rbk/qZDz4Do9Cq0rw=; b=owEBbQGS/pANAwAIAeAhynPxiakQAcsmYgBhkvg6xbXHYq6G60RTjNNOOr8Sb2tf3jRdUonT5HRZ NfjuZZ2JATMEAAEIAB0WIQSNS5MBqTXjGL5IXszgIcpz8YmpEAUCYZL4OgAKCRDgIcpz8YmpENR+CA CIbU0qFyfYzr7eokhif7TUIAqgYDKqiPuWicEyCP8VAQvNCrSlCF3msjSGz010MzaLIEpJGgNRTzm8 Yer5jF9A3+x2glX+TZWG/jqI0m8afg+z9nPq0z9JPPpbrAb1KFO7rX4yJJL+DRF+aDpk8h2wLQ3QBw dOjIPNjY1st7Q5A9rKDlEdmVMJ+Wox5ZCp9Ca9qU/B671egG9SyaShLnAjJdaGnGKZwrdAStKv1JOK 1RZVYs3w9kziDKB2WxVETrMbXlFAl4X0GJBLygpp2gZu3bPWkfJLbBD4veR2iYqryjk5vIG04CK/jU Tzpp9+CJzpBSz1QqiD8X4wYcP/TMi3 X-Developer-Key: i=vbabka@suse.cz; a=openpgp; fpr=A940D434992C2E8E99103D50224FA7E7CC82A664 X-Stat-Signature: t46q369cjcjy95xtqegp3w3f9e3jh8k3 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=0FYGsXL8; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="k/gGi2FO"; spf=pass (imf01.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D4C595092A17 X-HE-Tag: 1637021783-999571 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 96f429cebace..44a628897481 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)