From nobody Tue Feb 10 06:25:31 2026 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 AE0772EC562 for ; Mon, 12 Jan 2026 15:17:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768231028; cv=none; b=MclHBVdxWjeu0mczduWDe8Aho5owVUhj1+3KwQDfT4cl7On8kowba8yNKExXhRpiOsdCYytxUxKpm6UrpA6XT/uxzciwmLDacs+f9Rm/9bUvZxbRW6vZW9Mr+Zw8GzZY+yhlQCyXlIi/0lcEH/FrAvwQpXZmpBJFxbovUx1npvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768231028; c=relaxed/simple; bh=zoz/OqV+TRWrY/zIIcEmxGzDUjaW3y0rQSN1Tabq8Xo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XDL+oGmKaHhnb3cB2COUbEyVpS1CRFtzTgJE7jPUQh1YFYL2vmXu8lSEQdXI15S1oDtsd1de1WmFdqXgsR3Hlh+5KGqajX9GEO2PpBKUG+Kc/Yl7ULSosThn1qW4TJWq7SL5/AKr5zlzkpYmI915jra+3C2mjse6es6NPQuarqg= 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.130 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-out1.suse.de (Postfix) with ESMTPS id A16803368A; Mon, 12 Jan 2026 15:16:57 +0000 (UTC) Authentication-Results: smtp-out1.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 724203EA63; Mon, 12 Jan 2026 15:16:57 +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 eDpLG2kQZWn7FgAAD6G6ig (envelope-from ); Mon, 12 Jan 2026 15:16:57 +0000 From: Vlastimil Babka Date: Mon, 12 Jan 2026 16:16:57 +0100 Subject: [PATCH RFC v2 03/20] 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: <20260112-sheaves-for-all-v2-3-98225cfb50cf@suse.cz> References: <20260112-sheaves-for-all-v2-0-98225cfb50cf@suse.cz> In-Reply-To: <20260112-sheaves-for-all-v2-0-98225cfb50cf@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-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Flag: NO X-Spam-Score: -4.00 X-Rspamd-Queue-Id: A16803368A X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spam-Level: 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. Signed-off-by: Vlastimil Babka Reviewed-by: Harry Yoo --- 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 52591d9c04f3..54c17dc6d5ec 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -163,9 +163,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. */ @@ -190,9 +187,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) @@ -337,6 +331,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