From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Matt Vollrath <tactii@gmail.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Subject: Re: [PATCH iwl-next 0/3] iavf: defer loading netmem_desc
Date: Mon, 3 Aug 2026 18:41:27 +0200 [thread overview]
Message-ID: <057df130-7d7f-4d4c-8818-c494e4583afc@intel.com> (raw)
In-Reply-To: <e62e8603-a61d-489c-8df0-2c9ff98a1c02@gmail.com>
From: Matt Vollrath <tactii@gmail.com>
Date: Fri, 31 Jul 2026 15:27:37 -0400
> On 7/31/26 11:13, Alexander Lobakin wrote:
>> From: Matt Vollrath <tactii@gmail.com>
>> Date: Fri, 31 Jul 2026 08:41:06 -0400
>>
>>> In a few places libeth and the iavf driver inspect which page pool is
>>> attached to a netmem_ref. This forces an immediate load of the
>>> netmem_desc struct for each buffer in the Rx loop.
>>>
>>> Defer or eliminate these loads of netmem_desc from the driver fast path
>>> by using the page_pool ref in the first cache line of iavf_ring instead.
>>
>> I was thinking of this when implementing the current design, but:
>>
>> Do you have any data to prove this actually helps performance?
>
> The optimization was profile-driven, but not on an iavf. I was working on
> a libeth port of e1000e, because I'm an obsessive optimizer, and this quirk
> of the interface fell out. I'm working with a Xeon E3-1240 v3 and I218-V.
>
> With a mirror of the changes in this patch series, on my platform, it's a
> net zero overall change in Rx performance. This is not surprising, because
> the cold read is just deferred until later. The time saved in
> eth_type_trans (where the payload is first read) is instead spent in
> skb_gro_receive and pool puts.
>
> The additional thing that does make an improvement, which was omitted from
> this series, is prefetching netmem_desc early in the loop. This makes about
> 22 cycles/packet, 3% difference.
>
> I left it where it is because I don't have hardware to perf this on, and
> didn't know if anyone would even be interested in looking at something that
> I can't produce data for on the actual hardware. For iavf the prefetch
> would be conditional, only when the EOP flag is set, because in this case
> netmem_desc will always be needed either for GRO merge or pool put.
>
> I can't guarantee that this will be worth 3% on an iavf platform. In any
> case, it'll be a couple weeks before I can work on this again.
I asked because I was testing this approach on iavf and idpf when
developing the initial libeth code. But turned out that there was
[almost] no difference, while passing `struct page_pool *` to each
libeth Rx helper was very inconvenient and ugly. So I left it as it
is currently.
Moreover, most of libeth_xdp code couldn't take a separate PP pointer,
so it would make no sense at all since we're converting more and more
drivers to libeth_xdp helpers directly instead of raw libeth_rx. And
also, with XDP at least, the core either way accesses netmem_desc->pp.
So honestly I wouldn't make this change for some ghost benefit (the
current code is either way capable of handling 50-60 Mpps on XDP_DROP
despite that it reads netmem_desc->pp for each frame).
>
>>
>>>
>>> There are only two paths out of the Rx loop where netmem_desc needs to
>>> be consumed:
>>> * The "very rare" case of libeth_rx_sync_for_cpu calling
>>> libeth_rx_recycle_slow and indicating that there was no data. This
>>> could be similarly factored out, but not by this series.
>>> * GRO merging a frame into an existing aggregate stream. In this case,
>>> the cold load of netmem_desc may overlap the payload prefetch started
>>> by iavf_build_skb, which is now no longer dependent on netmem_desc to
>>> start.
>
> I see now this isn't right, anything going to GRO will end up back in the
> pool in the same iteration, and netmem_desc will be loaded. It just
> happens later.
Thanks,
Olek
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Matt Vollrath <tactii@gmail.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next 0/3] iavf: defer loading netmem_desc
Date: Mon, 3 Aug 2026 18:41:27 +0200 [thread overview]
Message-ID: <057df130-7d7f-4d4c-8818-c494e4583afc@intel.com> (raw)
In-Reply-To: <e62e8603-a61d-489c-8df0-2c9ff98a1c02@gmail.com>
From: Matt Vollrath <tactii@gmail.com>
Date: Fri, 31 Jul 2026 15:27:37 -0400
> On 7/31/26 11:13, Alexander Lobakin wrote:
>> From: Matt Vollrath <tactii@gmail.com>
>> Date: Fri, 31 Jul 2026 08:41:06 -0400
>>
>>> In a few places libeth and the iavf driver inspect which page pool is
>>> attached to a netmem_ref. This forces an immediate load of the
>>> netmem_desc struct for each buffer in the Rx loop.
>>>
>>> Defer or eliminate these loads of netmem_desc from the driver fast path
>>> by using the page_pool ref in the first cache line of iavf_ring instead.
>>
>> I was thinking of this when implementing the current design, but:
>>
>> Do you have any data to prove this actually helps performance?
>
> The optimization was profile-driven, but not on an iavf. I was working on
> a libeth port of e1000e, because I'm an obsessive optimizer, and this quirk
> of the interface fell out. I'm working with a Xeon E3-1240 v3 and I218-V.
>
> With a mirror of the changes in this patch series, on my platform, it's a
> net zero overall change in Rx performance. This is not surprising, because
> the cold read is just deferred until later. The time saved in
> eth_type_trans (where the payload is first read) is instead spent in
> skb_gro_receive and pool puts.
>
> The additional thing that does make an improvement, which was omitted from
> this series, is prefetching netmem_desc early in the loop. This makes about
> 22 cycles/packet, 3% difference.
>
> I left it where it is because I don't have hardware to perf this on, and
> didn't know if anyone would even be interested in looking at something that
> I can't produce data for on the actual hardware. For iavf the prefetch
> would be conditional, only when the EOP flag is set, because in this case
> netmem_desc will always be needed either for GRO merge or pool put.
>
> I can't guarantee that this will be worth 3% on an iavf platform. In any
> case, it'll be a couple weeks before I can work on this again.
I asked because I was testing this approach on iavf and idpf when
developing the initial libeth code. But turned out that there was
[almost] no difference, while passing `struct page_pool *` to each
libeth Rx helper was very inconvenient and ugly. So I left it as it
is currently.
Moreover, most of libeth_xdp code couldn't take a separate PP pointer,
so it would make no sense at all since we're converting more and more
drivers to libeth_xdp helpers directly instead of raw libeth_rx. And
also, with XDP at least, the core either way accesses netmem_desc->pp.
So honestly I wouldn't make this change for some ghost benefit (the
current code is either way capable of handling 50-60 Mpps on XDP_DROP
despite that it reads netmem_desc->pp for each frame).
>
>>
>>>
>>> There are only two paths out of the Rx loop where netmem_desc needs to
>>> be consumed:
>>> * The "very rare" case of libeth_rx_sync_for_cpu calling
>>> libeth_rx_recycle_slow and indicating that there was no data. This
>>> could be similarly factored out, but not by this series.
>>> * GRO merging a frame into an existing aggregate stream. In this case,
>>> the cold load of netmem_desc may overlap the payload prefetch started
>>> by iavf_build_skb, which is now no longer dependent on netmem_desc to
>>> start.
>
> I see now this isn't right, anything going to GRO will end up back in the
> pool in the same iteration, and netmem_desc will be loaded. It just
> happens later.
Thanks,
Olek
next prev parent reply other threads:[~2026-08-03 16:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 12:41 [PATCH iwl-next 0/3] iavf: defer loading netmem_desc Matt Vollrath
2026-07-31 12:41 ` [Intel-wired-lan] " Matt Vollrath
2026-07-31 12:41 ` [Intel-wired-lan] [PATCH iwl-next 1/3] libeth: add __libeth_rx_sync_for_cpu Matt Vollrath
2026-07-31 12:41 ` Matt Vollrath
2026-07-31 13:37 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-07-31 13:37 ` Loktionov, Aleksandr
2026-07-31 12:41 ` [Intel-wired-lan] [PATCH iwl-next 2/3] iavf: use __libeth_rx_sync_for_cpu Matt Vollrath
2026-07-31 12:41 ` Matt Vollrath
2026-07-31 13:38 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-07-31 13:38 ` Loktionov, Aleksandr
2026-07-31 12:41 ` [Intel-wired-lan] [PATCH iwl-next 3/3] iavf: use cached page_pool ref in skb helpers Matt Vollrath
2026-07-31 12:41 ` Matt Vollrath
2026-07-31 13:38 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-07-31 13:38 ` Loktionov, Aleksandr
2026-07-31 15:13 ` [PATCH iwl-next 0/3] iavf: defer loading netmem_desc Alexander Lobakin
2026-07-31 15:13 ` [Intel-wired-lan] " Alexander Lobakin
2026-07-31 19:27 ` Matt Vollrath
2026-07-31 19:27 ` [Intel-wired-lan] " Matt Vollrath
2026-08-03 16:41 ` Alexander Lobakin [this message]
2026-08-03 16:41 ` Alexander Lobakin
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=057df130-7d7f-4d4c-8818-c494e4583afc@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=tactii@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.