mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Network Development <netdev@vger.kernel.org>,
	linux-rdma@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, Moshe Shemesh <moshe@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>, Gal Pressman <gal@nvidia.com>,
	Carolina Jubran <cjubran@nvidia.com>,
	Sebastiano Miano <mianosebastiano@gmail.com>,
	Samuel Dobron <sdobron@redhat.com>
Subject: Re: [PATCH net-next] net/mlx5e: Reuse per-RQ XDP buffer to avoid stack zeroing overhead
Date: Fri, 16 May 2025 16:47:06 +0300	[thread overview]
Message-ID: <dcb3053f-6588-4c87-be42-a172dacb1828@gmail.com> (raw)
In-Reply-To: <CAADnVQLSMvk3uuzTCjqQKXs6hbZH9-_XeYo2Uvu2uHAiYrnkog@mail.gmail.com>



On 15/05/2025 3:26, Alexei Starovoitov wrote:
> On Wed, May 14, 2025 at 1:04 PM Tariq Toukan <tariqt@nvidia.com> wrote:
>>
>> From: Carolina Jubran <cjubran@nvidia.com>
>>
>> CONFIG_INIT_STACK_ALL_ZERO introduces a performance cost by
>> zero-initializing all stack variables on function entry. The mlx5 XDP
>> RX path previously allocated a struct mlx5e_xdp_buff on the stack per
>> received CQE, resulting in measurable performance degradation under
>> this config.
>>
>> This patch reuses a mlx5e_xdp_buff stored in the mlx5e_rq struct,
>> avoiding per-CQE stack allocations and repeated zeroing.
>>
>> With this change, XDP_DROP and XDP_TX performance matches that of
>> kernels built without CONFIG_INIT_STACK_ALL_ZERO.
>>
>> Performance was measured on a ConnectX-6Dx using a single RX channel
>> (1 CPU at 100% usage) at ~50 Mpps. The baseline results were taken from
>> net-next-6.15.
>>
>> Stack zeroing disabled:
>> - XDP_DROP:
>>      * baseline:                     31.47 Mpps
>>      * baseline + per-RQ allocation: 32.31 Mpps (+2.68%)
>>
>> - XDP_TX:
>>      * baseline:                     12.41 Mpps
>>      * baseline + per-RQ allocation: 12.95 Mpps (+4.30%)
> 
> Looks good, but where are these gains coming from ?
> The patch just moves mxbuf from stack to rq.
> The number of operations should really be the same.
> 

I guess it's cache related. Hot/cold areas, alignments, movement of 
other fields in the mlx5e_rq structure...

>> Stack zeroing enabled:
>> - XDP_DROP:
>>      * baseline:                     24.32 Mpps
>>      * baseline + per-RQ allocation: 32.27 Mpps (+32.7%)
> 
> This part makes sense.


  reply	other threads:[~2025-05-16 13:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 20:03 Tariq Toukan
2025-05-15  0:26 ` Alexei Starovoitov
2025-05-16 13:47   ` Tariq Toukan [this message]
2025-05-16 14:43     ` Jesper Dangaard Brouer
2025-05-21  8:56       ` Samuel Dobron
2025-05-16 22:50 ` 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=dcb3053f-6588-4c87-be42-a172dacb1828@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cjubran@nvidia.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=mianosebastiano@gmail.com \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=sdobron@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

all inboxes | Powered by JetHome®