Article View: linux.kernel.netdev
Article #18648Re: [PATCH] net: dst: Avoid false sharing between tclassid and __rcuref
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 16:58
Date: Wed, 18 Nov 2026 16:58
98 lines
11233 bytes
11233 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch moves tclassid after lwtstate in struct dst_entry
(include/net/dst.h), which makes sizeof(struct dst_entry) on x86-64…
--
net: dst: Avoid false sharing between tclassid and __rcuref
On 64-bit builds, this commit moves dst_entry::tclassid to sit after
lwtstate, so it no longer shares a cache line with __rcuref. On x86-64,
struct dst_entry grows from 136 to 144 bytes. The commit message says the
SLAB_HWCACHE_ALIGN caches used for rtable and rt6_info absorb the growth.
> diff --git a/include/net/dst.h b/include/net/dst.h
> index dbedfe72e1fd1..f01cfb42f97c1 100644
> --- a/include/net/dst.h
> +++ b/include/net/dst.h
[ ... ]
> @@ -94,6 +94,7 @@ struct dst_entry {
> struct uncached_list *rt_uncached_list;
> #ifdef CONFIG_64BIT
> struct lwtunnel_state *lwtstate;
> + __u32 tclassid;
> #endif
> };
[Severity: Medium]
The commit message says:
However, both struct rtable and struct rt6_info are allocated from slab
caches with SLAB_HWCACHE_ALIGN, so the per-object allocation sizes
remain unchanged at 192 bytes for rtable and 256 bytes for rt6_info.
Does the same hold for struct metadata_dst? It also embeds dst_entry, but
it is allocated with kmalloc and not from an aligned cache:
include/net/dst_metadata.h:
struct metadata_dst {
struct dst_entry dst;
enum metadata_type type;
union {
struct ip_tunnel_info tun_info;
...
} u;
};
The union is 16-byte aligned because ip_tunnel_info::options[] is marked
__aligned_largest. So the 8-byte growth of dst_entry becomes 16 bytes
here. On x86-64 with CONFIG_DST_CACHE=y, sizeof(struct metadata_dst) goes
from 240 to 256.
metadata_dst_alloc() then allocates that size plus the options length:
net/core/dst.c:metadata_dst_alloc() {
...
md_dst = kmalloc_flex(*md_dst, u.tun_info.options, optslen, flags);
...
}
With the new 256-byte base, does any optslen > 0 now land in kmalloc-512
instead of kmalloc-256?
On a collect_md device, vxlan_rcv() does this for every received packet:
tun_dst = udp_tun_rx_dst(skb, vxlan_get_sk_family(vs), flags,
key32_to_tunnel_id(vni), sizeof(*md));
That reaches udp_tun_rx_dst()->__ip_tun_set_dst()->metadata_dst_alloc()
with GFP_ATOMIC and optslen = sizeof(struct vxlan_metadata), which is 4.
Before this patch the allocation is 244 bytes (kmalloc-256). After it,
the allocation is 260 bytes (kmalloc-512).
geneve_rx() passes gnvh->opt_len * 4. Before the patch, options of up to
16 bytes still fit in kmalloc-256. After it, would any Geneve option at
all push the allocation into kmalloc-512?
The growth also applies to 64-bit kernels built with
CONFIG_IP_ROUTE_CLASSID=n, where nothing reads tclassid on the hot path.
Could the commit message cover the metadata_dst case? Alternatively,
could the layout be arranged so that metadata_dst stays within the
256-byte kmalloc bucket?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116015732.2744688-1-jiebin.sun%40intel.com
Technical Details
Message-ID:
<179502112428.3136.7381445616366581807@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366292-linux-kernel-netdev=dewy.ruReferences:
<20261116015732.2744688-1-jiebin.sun@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366292-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net: dst: Avoid false sharing between tclassid and __rcuref Date: Wed, 18 Nov 2026 16:58:44 +0000 Organization: Usenet Network Message-ID: <179502112428.3136.7381445616366581807@kernel.org> References: <20261116015732.2744688-1-jiebin.sun@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2645426"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ct02Z70kdRaB7+w1X3c6pcKnKAU= sha256:646mzW/mloKC4dLAN2DRBuWD7UOxvj9pviX3F8if3H4= sha1:P0606RwDV7AA11peBMpxU/22buA= sha256:TfWaGCl8wreK8f5sxJM+29088AlsGa/MkLuegDd+SL8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id E189211530A; Wed, 18 Nov 2026 19:59:10 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id stYBe3i2C70v; Wed, 18 Nov 2026 19:58:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366292-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 4F04B115335; Wed, 18 Nov 2026 19:58:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id AECAC3A186; Wed, 18 Nov 2026 16:58:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795021126; b=zObl3eqIlfBUkwgPlfZEnGI2vvv1lNJTVwkJAj0/P+XZdcSnLG17U4g2mj3hYf1WrbJu 09X+5XF1q65QKeKIT+6TmoOWVdcgeug2wnS6ScpRpU1PZHLf6AfrJRssP66WAYe5LZ+j/ v8YaILzeYYNe8/gUMXYC52BetNnyyvns2i/wCDzcp7u5/LTOKmkNNgY1rf64qYtCEAOjx apPOu1+aBsfT37ZNTc4pdkLZyq4mIk7WxHQ1vvlpCztougzHbhz7B2A3vbuf3+q2eqYWJ UXB6PXGsB6jI/GhyZFa9gaWL8PyMVLMa3MDJ57Brcq67u9ZDZRprYfoIk+bXdZujIcg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795021126; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=V+EJ9RUzxCOAUO4kV71qX/xQMGJep7DBGe17w5CTk4o=; b=cyLi59ebkPCclbaY7Zbp4bWoz6dTcJDPDm+D9N+MEyb3dcdlgRhK7v9kXQRT09CmFrvN bPyyGUf3qxFPt4cQ+61STRa/3d6RjhGoohcQ9A5GUnSBb3vHoiL+L3ga1822QEEi8Q1b9 rflg1IkUaOUg7rYxqBzZn+Mob0Bd8APGG1nY+df4KmR2N+9hnNTkL/gFNVBU7AxzRLYao kfiZAMCMfPRNvg9VCy3GG/LYpLODbi9bio5GBgq2nQRksoUUIQO/fNvg1zBZ5QsGRfuKI DJH5h2GVqNN70vWnBoUD1k694NHpdh/ywIsbiaqrIPrOrbBfSI71BgcZcTajsAlihpg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RrpNn6y+; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71AAD606A335; Wed, 18 Nov 2026 16:58:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RrpNn6y+ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795021125; b=vulYEU9MNP5syxoYBp9lBzN7Jfl/buC/6d0CSoZtvcKcdC9wPSbWeraFB9AJyTXqwRtY kW9QMG86JtEzTMUBpPajnEJQ0NAn41IItLcxoghN4nIdhaNCDFG4q3W1WovCq0h0vgDr4 ab8VwqR+jWf1MejjPkffGYbCsjjVIYytXbRyZFHvD/NppfPhYM6JVQxJ7+D5ot+mTKmLh 8zHGDu/eQJmNbHeQdegXkxnSTfMSP8i+IhNKX7asojPhbTcz+pfDy1t2Ka76jskRKe5ls O3Q77RzP5Lx/R6qBNDV9DTMyxFGqY/jAo1qOj+nq29QPYCHbyFo2xgs55qyO9xPETgg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795021125; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=V+EJ9RUzxCOAUO4kV71qX/xQMGJep7DBGe17w5CTk4o=; b=AdF6cx75EHl2AeDT475Dcf8q9jjFSLfA39FFQRAZcbBEYDKqAixLlPYz74QYII3HRYtr rtw00pjyZqMBt/wbH8OkEXHkozy0QZ2/mw4iNb31+Tzs3v+GCc80LuUAEUfPSJUt1ezy7 dkPNFcjdRkXfOr7x8ulp3ymF6UpX9mfs6EVZAuMa2vgirVpEWRtbdp35rxtklY6XWYXl0 JnXJlAk8SCNChHjDgFNLu3G848qzTV8ezGBmLTY3dXInz8+wqLKBe4SBiHtisZFKgoXkb crSB+AxjNs3DLw9f/YBuAQWGEiFrgDe4wUBQ7LN/u2N1OO/sLU9O9FydJ+iNHLp9M9g== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RrpNn6y+; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90C6A606A31C; Wed, 18 Nov 2026 16:58:45 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE9F31F000C4; Wed, 18 Nov 2026 16:58:44 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795021125; bh=V+EJ9RUzxCOAUO4kV71qX/xQMGJep7DBGe17w5CTk4o=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RrpNn6y+46QpHOKdkuUZGRwTHBl2RNFAcYLU0yhTf1eIFbFQ5Sjn2IoCVG/QNFDrB c7cLq6Yfbf4MYDoVspr2ozfH6ynwL+0ji76+UISzk6VUdLA+p3wsBPYr4LELz59JhK 4+5JfoDsidETaf7xeKUjDOA+/grt5FpJhPbgAJnLWLMQzMvAgduXsQX1adEW8pfnyS qFvaVLxxygBnEm5YD/SmXO3EjGtaGU/qrVzuVDFM8+c1HGvcDN68kt1BifltYnex1P Vs+gHY0VArQUN37M8fGmi42JdCcOeOEwoE9OmOiSQPDUbnNUYgpYQqPT+kuGioOcbE MoFxd8al8Y2TQ== X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, linux-kernel@vger.kernel.org, tim.c.chen@linux.intel.com, tianyou.li@intel.com, wangyang.guo@intel.com X-In-Reply-To: <20261116015732.2744688-1-jiebin.sun@intel.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list