From nobody Mon May 25 04:33:44 2026 Received: from relay.yourmailgateway.de (relay.yourmailgateway.de [188.68.63.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51C6E387363 for ; Mon, 18 May 2026 18:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.68.63.162 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779128841; cv=none; b=Mwy0RZY7mmlsAtu4/brWkeMCrMVCzyNz2DILExXuH14M1Y8YtjFu/d7C6rS4ya+WLbe6rE04GP3HbkpjWahnwz5vEy+MghuwDDxVQEJPXR2h/ASBZrI6TRPLlgUmEMa+l3EqoZCck4BOAsTWe6BS3ptD6KvogQDkey4hiFOtToc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779128841; c=relaxed/simple; bh=Lf7UAWV/kjUUhHpP0mRUhuZ1JIY/eond5cWSDt9e0qo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MCKbi6l9eHzg13QGoXH50h+JJn3VSuBOF/f2eFu9TUzjrl4rHBcrJExC/fcxXxSmGu7/dqNYKtt16Iyk/g+TNwjMI3ibgAmPewEyqAzGylIDxTQ1W92PSkrYDSKs4pr8o4WRzexaXJtSO4hwmhHvi2ib9lZgvq7F4Fi1HL2S99w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=phwe.de; spf=pass smtp.mailfrom=phwe.de; dkim=pass (2048-bit key) header.d=phwe.de header.i=@phwe.de header.b=f/y2DjST; arc=none smtp.client-ip=188.68.63.162 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=phwe.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=phwe.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=phwe.de header.i=@phwe.de header.b="f/y2DjST" Received: from mors-relay-8201.netcup.net (localhost [127.0.0.1]) by mors-relay-8201.netcup.net (Postfix) with ESMTPS id 4gK5qv5s7sz44h2; Mon, 18 May 2026 20:27:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phwe.de; s=key2; t=1779128827; bh=Lf7UAWV/kjUUhHpP0mRUhuZ1JIY/eond5cWSDt9e0qo=; h=From:To:Cc:Subject:Date:From; b=f/y2DjSTtevyYLpzRWSovDDwBzRRiNnP/03nu7Lt6SI2wYkst+Hw0fSd2/oc5xNTC 2L01yeVncrsO8h0P3E5utM7dpab9LIRpLwI0YE6ggKKTRrtUmL4bM9AikIa9mBQqFt TcXs6xTwwVzvw+gAD9BqXd65H/0eHZSZeLkTtzud01lqH4LXzGikk2bzT+jnFemQac 66m5gUmcqebHjfZxU/86bVlxs+MzbWSXA+TnVBqfQEmQcxcDmhOeNiWwC8PCGW+Lew oUMy8O6ePhtZh5kBI3gyqoOaEbgeV9wsdmWNgfeZHp17gyp82XbnN+gO0n2/cUizX9 jk0tvS50ifrqA== Received: from policy02-mors.netcup.net (unknown [46.38.225.35]) by mors-relay-8201.netcup.net (Postfix) with ESMTPS id 4gK5qv56nlz44gx; Mon, 18 May 2026 20:27:07 +0200 (CEST) Received: from mxe95c.netcup.net (unknown [10.243.12.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by policy02-mors.netcup.net (Postfix) with ESMTPS id 4gK5qv0HbJz8sZP; Mon, 18 May 2026 20:27:06 +0200 (CEST) Received: from mandalore.fritz.box (p5dd24ed4.dip0.t-ipconnect.de [93.210.78.212]) by mxe95c.netcup.net (Postfix) with ESMTPSA id D1CC68019F; Mon, 18 May 2026 20:27:05 +0200 (CEST) Authentication-Results: mxe95c; spf=pass (sender IP is 93.210.78.212) smtp.mailfrom=kernel@phwe.de smtp.helo=mandalore.fritz.box Received-SPF: pass (mxe95c: connection is authenticated) From: Philipp Weber To: akpm@linux-foundation.org Cc: kees@kernel.org, brauner@kernel.org, jack@suse.cz, vbabka@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] ipc/msg: Use dedicated slab buckets for msg_msgseg Date: Mon, 18 May 2026 20:26:31 +0200 Message-ID: <20260518182636.58134-1-kernel@phwe.de> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <177912882656.211742.12285739949726872344@mxe95c.netcup.net> X-NC-CID: MAsjFXrDzJtuEJ4q9m8J8draoP01HUam7Q4eFRsrvg== Content-Type: text/plain; charset="utf-8" System V message queues already allocate struct msg_msg from dedicated kmem buckets, so user-controlled variable-sized message allocations do not share generic kmalloc buckets. Large messages allocate additional struct msg_msgseg objects for the remaining payload. These allocations are also user-controlled in size and contents, but still come from generic kmalloc-cg buckets. Allocate msg_msgseg objects from a dedicated bucket set as well, so the segmented payload path follows the same heap-isolation model as the main msg_msg allocation. The free path remains unchanged because these allocations are freed with kfree(), matching the existing msg_msg bucket allocation. Signed-off-by: Philipp Weber Acked-by: Vlastimil Babka (SUSE) --- ipc/msgutil.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ipc/msgutil.c b/ipc/msgutil.c index e28f0cecb2ec..8aa8ac180317 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c @@ -40,6 +40,7 @@ struct msg_msgseg { #define DATALEN_SEG ((size_t)PAGE_SIZE-sizeof(struct msg_msgseg)) =20 static kmem_buckets *msg_buckets __ro_after_init; +static kmem_buckets *msgseg_buckets __ro_after_init; =20 static int __init init_msg_buckets(void) { @@ -47,6 +48,10 @@ static int __init init_msg_buckets(void) sizeof(struct msg_msg), DATALEN_MSG, NULL); =20 + msgseg_buckets =3D kmem_buckets_create("msg_msgseg", SLAB_ACCOUNT, + sizeof(struct msg_msgseg), + DATALEN_SEG, NULL); + return 0; } subsys_initcall(init_msg_buckets); @@ -73,7 +78,8 @@ static struct msg_msg *alloc_msg(size_t len) cond_resched(); =20 alen =3D min(len, DATALEN_SEG); - seg =3D kmalloc(sizeof(*seg) + alen, GFP_KERNEL_ACCOUNT); + seg =3D kmem_buckets_alloc(msgseg_buckets, + sizeof(*seg) + alen, GFP_KERNEL); if (seg =3D=3D NULL) goto out_err; *pseg =3D seg; base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8 --=20 2.53.0