From patchwork Mon Nov 13 19:13:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13454369 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 7E72AC4332F for ; Mon, 13 Nov 2023 19:14:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90E0F6B027A; Mon, 13 Nov 2023 14:14:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 55BD36B027B; Mon, 13 Nov 2023 14:14:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D25016B027D; Mon, 13 Nov 2023 14:14:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A4BC76B0280 for ; Mon, 13 Nov 2023 14:14:17 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 893601CAAB8 for ; Mon, 13 Nov 2023 19:14:17 +0000 (UTC) X-FDA: 81453881754.03.F74C17F Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf20.hostedemail.com (Postfix) with ESMTP id 8C8D71C0013 for ; Mon, 13 Nov 2023 19:14:15 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=RpQWn4sN; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=J0Xb8K74; dmarc=none; spf=pass (imf20.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699902855; 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=uxDKJC7EaSr87DEKt16Pu1EQtaytOZJplZCJuXCflPQ=; b=zUOPSodbFLPQXyG/wWs34uQa9rkIBy5ynIJE/8MkBu7MwMKEq5r26voi2Ijc3CHjeyzNe0 qqE0aNf+NvOB25VblbuIa633BXaPbq3ZueJSI+95G6EtwzNfbGjHCTtaPIFHjUc0twhm+J Fizmjkis5+QSBtdWgb52NDJluijhHBI= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=RpQWn4sN; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=J0Xb8K74; dmarc=none; spf=pass (imf20.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699902855; a=rsa-sha256; cv=none; b=PFeaJ1MtKw3bSZa4mk+/uxQ4cHQeVSubcGHJlqJ1PUg114LXGDthd4Y5tjqsjr2VJqKxj4 I2TUKJsOUf0O0D71su/+xwxFjv3UZokDk4tRnt8ZuU+lop/XZAdHpX5kQq01Wx/U6d/3W9 N0/4OjqcfwB3AZ73P++ivibaXu1uqfE= 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 43E4121921; Mon, 13 Nov 2023 19:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1699902854; 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=uxDKJC7EaSr87DEKt16Pu1EQtaytOZJplZCJuXCflPQ=; b=RpQWn4sNOjvxQkBfvziEPCXxoX0JJgRJTkNkPNoDx/u5y33ryL9WYixguPSuIwJapxRSFp AnfCHIeUs+kc3EO/R4GuVNcDzoOC4rSh0NBIXZNFQwxvjDZLRjFCum/optDZuilffC474u tee5JYU2/7OLrEmYmcRFK7UVMMWoqUY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1699902854; 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=uxDKJC7EaSr87DEKt16Pu1EQtaytOZJplZCJuXCflPQ=; b=J0Xb8K74DAapEo1JughDOaWB/XF9aekqQd4Wz+eKRt3buDbcskFeZhJrmp1eaLQ4qLv7NQ 4nRKvtRZ93s5I0Dg== 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 E25AE13398; Mon, 13 Nov 2023 19:14:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QNKnNoV1UmVFOgAAMHmgww (envelope-from ); Mon, 13 Nov 2023 19:14:13 +0000 From: Vlastimil Babka To: David Rientjes , Christoph Lameter , Pekka Enberg , Joonsoo Kim Cc: Andrew Morton , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Marco Elver , Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Kees Cook , kasan-dev@googlegroups.com, cgroups@vger.kernel.org, Vlastimil Babka Subject: [PATCH 14/20] mm/slab: move struct kmem_cache_node from slab.h to slub.c Date: Mon, 13 Nov 2023 20:13:55 +0100 Message-ID: <20231113191340.17482-36-vbabka@suse.cz> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231113191340.17482-22-vbabka@suse.cz> References: <20231113191340.17482-22-vbabka@suse.cz> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8C8D71C0013 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 5kj9bedinqjdhyf3gntucq3tu5dcozm6 X-HE-Tag: 1699902855-404223 X-HE-Meta: U2FsdGVkX18+PHuvN4rpYzWnrDDIRpYl68Ebw/UWjQU8OELF6xkVQ8T8NNuoC1E7dIgtmSyp9QyyjAS2nrWOblMJMPUE0m7Gt0gtA1C1LN5eQL+rMTbOexXSG6Y6cnH6s6vHOg1QIonXcpCHgStjRZp+ojRg3jcgZIXZvct9D2pxRYhIxJCULUqS3uVnT/cvZgQW5Nb2/v4viaLGqhULIp7M4RVRUFT+FTyCSD7AEKQGFugW/QV49UJg3QoBKTe4rM7Ls86Ha2lyhkM22Eo4NKq2MOK4xoLc6tclSpz8IOMAl/glxMKt2M+DWX1RcsjMUcEEO/bdAngbepIjoeX5CGe3AvmZSBuQuEckPo0zy+ftREg1uhiY4vjy4gNh4hY/euiD1EoQq2gQx3ak4xhSFsFuCZIV1gCRVyUFG95F/Yr3c+guaxH0tYfW34+4QQoCYruS96LrK7+ZS81WLrjR6oMa8tsssC+kmCJ0gbEFHVvpYDHxmBVuDOW8bbgriKE30/wg1rwZsp3wj3NeSZpAF9fUZ8yCvPaQam8tToYqS4sc9T7EvqVPhUlHTnm7PN39H4JbSNEN4uFC/tpoWH7NEL34lWerJjW0TVJEVQmumKu6wovz/RDR2Lv9nQEvgxrZIFVXnCs0ZdacjteVex978D8D8bCYE6VsxDxVsJtruePZLyeXS1DHrncb7k8o4Lj6vFQjX3doNglqAumJrk0HULgW3ipYnixd4M94mSGKt7uL3ryL7qzqKbeTyI6bi7UbSXgVfkn1+kgrqLp465yZkbRPf2Hm4dljkNaTOg45y+wgGGZiIh5N08BrBYsXHNtnxwDnyBrfRgLTI0O6slu9vpvcidpU6QJHnnALEo2c/59EmUxTTGfZUQwZXK0p8yu2dWyDNJ5kmypqe/W9VUgUfl6/ykprjQD3biLN2Er88dX7TwknfMOWlINUvIZHMBAg1xu2gSsn8BoRQbr5EE3 s4fPKAyI jN3nZHUYFFjhxWrJbpXeORr0/hEsZGqa6GOyA//VRNgnUSVAXKUGJ9XTwGWu5KhLgIuEMDnvjN6BLAQrOteSRFRSr9E6xMFmRzrRZaq3GZ6osjOLYFHpG/994wyX+R0SVWFRJbbipJCsh3WDy8D6qkADlk34TMgDROOPJ3B29rx1hoymRBsQV3cynxJ9fHqOVS/URDrkxZM04jOs+We7gKCpp6I/+YDMYufllWhhJEecyFYkWFxHbDOhDDcg9ySqEsQyIEqyLp4T3Iy62gfIxEJBiQ5dPJJ0Hf68KKInJGDtI41fpUKoLmDg/tg== 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: The declaration and associated helpers are not used anywhere else anymore. Signed-off-by: Vlastimil Babka Reviewed-by: Kees Cook --- mm/slab.h | 29 ----------------------------- mm/slub.c | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/mm/slab.h b/mm/slab.h index 8de9780d345a..1b09fd1b4b04 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -587,35 +587,6 @@ static inline size_t slab_ksize(const struct kmem_cache *s) return s->size; } - -/* - * The slab lists for all objects. - */ -struct kmem_cache_node { - spinlock_t list_lock; - unsigned long nr_partial; - struct list_head partial; -#ifdef CONFIG_SLUB_DEBUG - atomic_long_t nr_slabs; - atomic_long_t total_objects; - struct list_head full; -#endif -}; - -static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) -{ - return s->node[node]; -} - -/* - * Iterator over all nodes. The body will be executed for each node that has - * a kmem_cache_node structure allocated (which is true for all online nodes) - */ -#define for_each_kmem_cache_node(__s, __node, __n) \ - for (__node = 0; __node < nr_node_ids; __node++) \ - if ((__n = get_node(__s, __node))) - - #ifdef CONFIG_SLUB_DEBUG void dump_unreclaimable_slab(void); #else diff --git a/mm/slub.c b/mm/slub.c index 25ff9d2d44a8..0dbb966e28a7 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -396,6 +396,33 @@ static inline void stat(const struct kmem_cache *s, enum stat_item si) #endif } +/* + * The slab lists for all objects. + */ +struct kmem_cache_node { + spinlock_t list_lock; + unsigned long nr_partial; + struct list_head partial; +#ifdef CONFIG_SLUB_DEBUG + atomic_long_t nr_slabs; + atomic_long_t total_objects; + struct list_head full; +#endif +}; + +static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) +{ + return s->node[node]; +} + +/* + * Iterator over all nodes. The body will be executed for each node that has + * a kmem_cache_node structure allocated (which is true for all online nodes) + */ +#define for_each_kmem_cache_node(__s, __node, __n) \ + for (__node = 0; __node < nr_node_ids; __node++) \ + if ((__n = get_node(__s, __node))) + /* * Tracks for which NUMA nodes we have kmem_cache_nodes allocated. * Corresponds to node_state[N_NORMAL_MEMORY], but can temporarily