From nobody Tue Feb 10 09:57:28 2026 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B985532B9BC for ; Fri, 23 Jan 2026 06:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769151215; cv=none; b=ikBYVbTP33cPX3sLWVCksGE/q0BT6ksZBQ/mYioBBGg4wZGfYzrSdWD71uB2zDaqzWSwW2iJQw/VdWGzgoH0kq1o036hS/Vbc9tioVld9DFv4G2BM3D/1Lx6z0jjuPGC0eo1/Ger5N2d0dCosVBShsaue96WzUw4PMzLGSHZ/BY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769151215; c=relaxed/simple; bh=1sIYXomChyE7LIVmIqeKCKeMmWHWJvhIg/GZFOjLsSM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZBIFF+wIMnJA6Olwx/SbFAz1vuBNmAUeXwcJtjWpYUxrgIFVH8SGEbYBb7a+SRJWzh+SGXn81eifUOB0V3doZjpzivIUAu9zGlbhUQiuiDcDTB0vwSsjZ2U9EOIhYOvrybW9pg/nEtR1cexhp3F9ey0OTRzPUqPcO1PqqeaYkKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id ACE3E5BCCF; Fri, 23 Jan 2026 06:53:10 +0000 (UTC) Authentication-Results: smtp-out2.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 96A26139EC; Fri, 23 Jan 2026 06:53:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KGCAJNUac2k4YgAAD6G6ig (envelope-from ); Fri, 23 Jan 2026 06:53:09 +0000 From: Vlastimil Babka Date: Fri, 23 Jan 2026 07:52:43 +0100 Subject: [PATCH v4 05/22] mm/slab: make caches with sheaves mergeable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260123-sheaves-for-all-v4-5-041323d506f7@suse.cz> References: <20260123-sheaves-for-all-v4-0-041323d506f7@suse.cz> In-Reply-To: <20260123-sheaves-for-all-v4-0-041323d506f7@suse.cz> To: Harry Yoo , Petr Tesarik , Christoph Lameter , David Rientjes , Roman Gushchin Cc: Hao Li , Andrew Morton , Uladzislau Rezki , "Liam R. Howlett" , Suren Baghdasaryan , Sebastian Andrzej Siewior , Alexei Starovoitov , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, bpf@vger.kernel.org, kasan-dev@googlegroups.com, Vlastimil Babka X-Mailer: b4 0.14.3 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spam-Score: -4.00 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Rspamd-Queue-Id: ACE3E5BCCF X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Level: X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLfsjnp7neds983g95ihcnuzgq)] X-Spam-Flag: NO Before enabling sheaves for all caches (with automatically determined capacity), their enablement should no longer prevent merging of caches. Limit this merge prevention only to caches that were created with a specific sheaf capacity, by adding the SLAB_NO_MERGE flag to them. Reviewed-by: Harry Yoo Signed-off-by: Vlastimil Babka Reviewed-by: Liam R. Howlett --- mm/slab_common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index ee245a880603..5c15a4ce5743 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -162,9 +162,6 @@ int slab_unmergeable(struct kmem_cache *s) return 1; #endif =20 - if (s->cpu_sheaves) - return 1; - /* * We may have set a slab to be unmergeable during bootstrap. */ @@ -189,9 +186,6 @@ static struct kmem_cache *find_mergeable(unsigned int s= ize, slab_flags_t flags, if (IS_ENABLED(CONFIG_HARDENED_USERCOPY) && args->usersize) return NULL; =20 - if (args->sheaf_capacity) - return NULL; - flags =3D kmem_cache_flags(flags, name); =20 if (flags & SLAB_NEVER_MERGE) @@ -336,6 +330,13 @@ struct kmem_cache *__kmem_cache_create_args(const char= *name, flags &=3D ~SLAB_DEBUG_FLAGS; #endif =20 + /* + * Caches with specific capacity are special enough. It's simpler to + * make them unmergeable. + */ + if (args->sheaf_capacity) + flags |=3D SLAB_NO_MERGE; + mutex_lock(&slab_mutex); =20 err =3D kmem_cache_sanity_check(name, object_size); --=20 2.52.0