public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
	Florian Westphal <fw@strlen.de>
Subject: Re: [PATCH net-next] xfrm: reduce struct sec_path size
Date: Mon, 9 Feb 2026 06:55:01 +0100	[thread overview]
Message-ID: <aYl2tYaNpdYVU8hN@secunet.com> (raw)
In-Reply-To: <83846bd2e3fa08899bd0162e41bfadfec95e82ef.1770398071.git.pabeni@redhat.com>

On Fri, Feb 06, 2026 at 06:14:36PM +0100, Paolo Abeni wrote:
> The mentioned struct has an hole and uses unnecessary wide type to
> store MAC length and indexes of very small arrays.
> 
> It's also embedded into the skb_extensions, and the latter, due
> to recent CAN changes, may exceeds the 192 bytes mark (3 cachelines
> on x86_64 arch) on some reasonable configurations.
> 
> Reordering and the sec_path fields, shrinking xfrm_offload.orig_mac_len
> to 16 bits and xfrm_offload.{len,olen,verified_cnt} to u8, we can save
> 16 bytes and keep skb_extensions size under control.
> 
> Before:
> 
> struct sec_path {
> 	int                        len;
> 	int                        olen;
> 	int                        verified_cnt;
> 
> 	/* XXX 4 bytes hole, try to pack */$
> 	struct xfrm_state *        xvec[6];
> 	struct xfrm_offload ovec[1];
> 
> 	/* size: 88, cachelines: 2, members: 5 */
> 	/* sum members: 84, holes: 1, sum holes: 4 */
> 	/* last cacheline: 24 bytes */
> };
> 
> After:
> 
> struct sec_path {
> 	struct xfrm_state *        xvec[6];
> 	struct xfrm_offload        ovec[1];
> 	/* typedef u8 -> __u8 */ unsigned char              len;
> 	/* typedef u8 -> __u8 */ unsigned char              olen;
> 	/* typedef u8 -> __u8 */ unsigned char              verified_cnt;
> 
> 	/* size: 72, cachelines: 2, members: 5 */
> 	/* padding: 1 */
> 	/* last cacheline: 8 bytes */
> };
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Reviewed-by: Steffen Klassert <steffen.klassert@secunet.com>


  parent reply	other threads:[~2026-02-09  6:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 17:14 [PATCH net-next] xfrm: reduce struct sec_path size Paolo Abeni
2026-02-07 10:39 ` Florian Westphal
2026-02-09  5:55 ` Steffen Klassert [this message]
2026-02-11  5:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYl2tYaNpdYVU8hN@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox