From patchwork Mon Nov 20 18:34:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13461887 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 D47F6C2BB3F for ; Mon, 20 Nov 2023 18:35:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF73A6B03EF; Mon, 20 Nov 2023 13:34:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A5AA06B040B; Mon, 20 Nov 2023 13:34:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AB8E6B03EF; Mon, 20 Nov 2023 13:34:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 14AA56B0406 for ; Mon, 20 Nov 2023 13:34:48 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D73771405EC for ; Mon, 20 Nov 2023 18:34:47 +0000 (UTC) X-FDA: 81479183814.04.0D29224 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf09.hostedemail.com (Postfix) with ESMTP id A55F3140009 for ; Mon, 20 Nov 2023 18:34:45 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=TukUKNES; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="SR+5CH/H"; spf=pass (imf09.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700505286; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YBNKkmC9oRR4moRDCZJShxotomqe2hJVkCMX0lOWDT0=; b=DcXSSYSIP3LfLvDq4CyNVY0Akl++LNn//Pj80XAzIojh0AgrF34U+dDXWAeDHU6dZFkI5b ND5v0T1q83XVjClxPLjfRgbK0Jufouq1b8Hz9MKb+5LPFp03Mt0ES7bWJ51BjYbJTR+oZG FXZ/4ZenXv68pzNvV5sBalQGFH7Ykn8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700505286; a=rsa-sha256; cv=none; b=iQBRTYoIiukB+WCI9BzeI9UDksud+NasRlO8uHD7BQ61VM3xZsWBlaFwY2vAjP2n0GoicZ 98cUydhBOSiC1rr68s+/BKsclXpbDwtq3qWPkwIHpSK9Ht9OkbVtEcs+hlt9+P/UvRnu8q AUXEtM7kCl0fV2sXvg8YRcYJ20s8xQA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=TukUKNES; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="SR+5CH/H"; spf=pass (imf09.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none 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 EC4921F8B5; Mon, 20 Nov 2023 18:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1700505283; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YBNKkmC9oRR4moRDCZJShxotomqe2hJVkCMX0lOWDT0=; b=TukUKNESscidwt/2HBbv9/QdKcUrR+ZMvZ2dwKNTRUvpZLKBrUzw54CbiQf8E5vRUaPkQW 1rRAQ63ZurVmskb+XqiXgO2mLhOF5Fzy64zH68A0TEvAwYSNZzPzL52VYwtVwY3fpCvib1 HIug0uwGaklIeMI279eHJYFU+XGOlz0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1700505283; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YBNKkmC9oRR4moRDCZJShxotomqe2hJVkCMX0lOWDT0=; b=SR+5CH/H44O/VS9uuX9x6H111+uuPIaCWhUer0Ci8w7b+LNUfw2Va5lgqrYu34tElKTvOE d2CZZcN/Hnj3BeBA== 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 BAB8F13912; Mon, 20 Nov 2023 18:34:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eEMcLcKmW2UUMgAAMHmgww (envelope-from ); Mon, 20 Nov 2023 18:34:42 +0000 From: Vlastimil Babka Date: Mon, 20 Nov 2023 19:34:26 +0100 Subject: [PATCH v2 15/21] mm/slab: move struct kmem_cache_node from slab.h to slub.c MIME-Version: 1.0 Message-Id: <20231120-slab-remove-slab-v2-15-9c9c70177183@suse.cz> References: <20231120-slab-remove-slab-v2-0-9c9c70177183@suse.cz> In-Reply-To: <20231120-slab-remove-slab-v2-0-9c9c70177183@suse.cz> To: David Rientjes , Christoph Lameter , Pekka Enberg , Joonsoo Kim Cc: Andrew Morton , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Marco Elver , Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Kees Cook , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org, linux-hardening@vger.kernel.org, Vlastimil Babka X-Mailer: b4 0.12.4 X-Stat-Signature: qoctddbppfxbuah31bhnk1upgjunbi73 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A55F3140009 X-Rspam-User: X-HE-Tag: 1700505285-269992 X-HE-Meta: U2FsdGVkX1/kqxXSjmHB8V4yIotXoRWS4P56HW/IUWPnopWFlG2qLzSFj9Zk+mQIatcfZrddz+6p3THm7PBXwZg5bfzAHHrNTWhLuazyrV7oUS5AkW6pJLxCv4+rkyicqLJ1nGkOMrkQ3hQO6W7L1HXLqpWqbSucmalaOj90eOgyeq491B1ZjmtMsMD+5ykoNPCXEV7YFd4K1+zGOWc0qpAbPqUtuC7fr4ZbhLBilHVgwu7bR8MgeMhIIWHKXBgyBivq4Edtt5aqRP0PsGIXtrhgmJvAoSnIpCQcAmKJUBDkcLXaBSlmhlBWeowsXXAMGuQkXsos7D9ktABKe0o5lv15akU+xZ4BS5u/E8YQeP9WZGcAya7x7rjOnK15mVzuk6iO4fMm6ad4ZTbmB1owgv/7mcqoCk5zXrvlLNhS80NxQICiTz2FycWfqqoZ94jl3enmijdw9QlIN76zc6MM5AmJdWM46qqMumAcA/8byLfAhV56Wf11joy9D0N7tFoQ/0j8065F3edlGTH62mMJK2OC6NJRRCSA+qGCQSmsAO/DvROTrxqKZsm8wfJEa4gB81CBUS5jUaGaLbEh0xChUELMwqX2PyPWWu0JGbLf5I4t5uWbvsj24tvc+uBsi4hAr23O0HAFjwdl/7mvMnU9K4KuuMEb2JpumUFv9Jq74DsKja2n0fkPnX4xXIpLDtA9FXEGARn35lXwflYPY/bsj2Mn/1gdMYR7BMf0YV6mHe3kdXfZzTSOKX6jB13vz6VBdRKdp2X0TzR6Hae0IfOG08rukD2eapNQ3eQtcKNCCrc+wY40ePeS6NbYJOyfYp2UVYNEFlDVghBAmq3QebAzkiCt52cBDqz5/GIagZNHPoVIU/6in/2xr3p205JEr/1gGBRBuDK69TmKQ5be4OXfbkUU8SwYTshVIHrFr1+E02XDkGVQ1vRvpC9/0esv91h5AjmJA/5cR0HDyeYeag3 c5NjQleN 89NaI9Dpnp9SbqRRVQzM6KG6eOg5xgPVIJHvjWB4EZGAlAyV7U18Nbj8t8yNwnIbezyZwXxt7GCk4wuq/tF8rL0nm1LIXYIcjrQuNlZ+7P9TaEjNL9KarriQilVZ6PrNx1NBzpRqjD4iRaW7j/F5AVCnpmwpcmmsS2E/psJjG9pMreYtVFXLfZ5P0Q8PTG2RN/pGHXbAzNSHQDT2rafkAdK1TGBuSOHVu3XntmIIvMGLP/MEeJBeHYGLRoSt9QuDsNUSokfVdXViY3rcvNxjkxMrUgDNYuzfXr8nccpWfQBwtfPUwwRZxFSH97Gi5aCl5Kcd13OGvk8coQLsXThC56j7XlEEO5hnkE08vELdGateZDDrgjKehfWw18Q== 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. Reviewed-by: Kees Cook Signed-off-by: Vlastimil Babka Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- 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 a81ef7c9282d..5ae6a978e9c2 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -588,35 +588,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 844e0beb84ee..cc801f8258fe 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