From: Mina Almasry <almasrymina@google.com>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Mina Almasry <almasrymina@google.com>,
Joshua Washington <joshwash@google.com>,
Harshitha Ramamurthy <hramamurthy@google.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>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Simon Horman <horms@kernel.org>,
Willem de Bruijn <willemb@google.com>,
ziweixiao@google.com, Vedant Mathur <vedantmathur@google.com>
Subject: [PATCH net v1 2/2] gve: use max allowed ring size for ZC page_pools
Date: Wed, 5 Nov 2025 20:07:58 +0000 [thread overview]
Message-ID: <20251105200801.178381-2-almasrymina@google.com> (raw)
In-Reply-To: <20251105200801.178381-1-almasrymina@google.com>
NCCL workloads with NCCL_P2P_PXN_LEVEL=2 or 1 are very slow with the
current gve devmem tcp configuration.
Root causing showed that this particular workload results in a very
bursty pattern of devmem allocations and frees, exhausting the page_pool
ring buffer. This results in sock_devmem_dontneed taking up to 5ms to
free a batch of 128 netmems, as each free does not find an available
entry in the pp->ring, and going all the way down to the (slow) gen_pool,
and gve_alloc_buffer running into a burst of successive allocations
which also don't find entries in the pp->ring (not dontneed'd yet,
presumably), each allocation taking up to 100us, slowing down the napi
poll loop.
From there, the slowness of the napi poll loop results, I suspect,
in the rx buffers not being processed in time, and packet drops
detected by tcpdump. The total sum of all this badness results in this
workload running at around 0.5 GB/s, when expected perf is around 12
GB/s.
This entire behavior can be avoided by increasing the pp->ring size to the
max allowed 16384. This makes the pp able to handle the bursty
alloc/frees of this particular workload. AFACT there should be no
negative side effect of arbitrarily increasing the pp->ring size in this
manner for ZC configs - the memory is prealloced and pinned by the
memory provider anyway.
Tested by running AllToAll PXN=2 workload. Before:
Avg bus bandwidth : 0.434191
After:
Avg bus bandwidth : 12.5494
Note that there is more we can do to optimize this path, such as bulk
netmem dontneeds, bulk netmem pp refills, and possibly taking a page
from the iouring zcrx playbook and replacing the gen_pool with a simpler
fixed-size array based allocator, but this seems sufficient to fix these
critcal workloads.
With thanks to Willem and Eric for helping root cause this,
Cc: ziweixiao@google.com
Fixes: 62d7f40503bc ("gve: support unreadable netmem")
Reported-by: Vedant Mathur <vedantmathur@google.com>
Signed-off-by: Mina Almasry <almasrymina@google.com>
---
drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c b/drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c
index 0e2b703c673a..f63ffdd3b3ba 100644
--- a/drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c
+++ b/drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c
@@ -8,6 +8,8 @@
#include "gve.h"
#include "gve_utils.h"
+#include "net/netdev_queues.h"
+
int gve_buf_ref_cnt(struct gve_rx_buf_state_dqo *bs)
{
return page_count(bs->page_info.page) - bs->page_info.pagecnt_bias;
@@ -263,6 +265,8 @@ struct page_pool *gve_rx_create_page_pool(struct gve_priv *priv,
if (priv->header_split_enabled) {
pp.flags |= PP_FLAG_ALLOW_UNREADABLE_NETMEM;
pp.queue_idx = rx->q_num;
+ if (netif_rxq_has_unreadable_mp(priv->dev, rx->q_num))
+ pp.pool_size = PAGE_POOL_MAX_RING_SIZE;
}
return page_pool_create(&pp);
--
2.51.2.1026.g39e6a42477-goog
next prev parent reply other threads:[~2025-11-05 20:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 20:07 [PATCH net v1 1/2] page_pool: expose max page pool ring size Mina Almasry
2025-11-05 20:07 ` Mina Almasry [this message]
2025-11-05 21:58 ` [PATCH net v1 2/2] gve: use max allowed ring size for ZC page_pools Jesper Dangaard Brouer
2025-11-05 22:44 ` Mina Almasry
2025-11-05 22:15 ` Harshitha Ramamurthy
2025-11-05 22:46 ` Mina Almasry
2025-11-06 1:11 ` Jakub Kicinski
2025-11-06 1:56 ` Mina Almasry
2025-11-06 2:22 ` Jakub Kicinski
2025-11-06 2:56 ` Mina Almasry
2025-11-06 17:25 ` Dragos Tatulea
2025-11-07 1:18 ` Jakub Kicinski
2025-11-07 13:35 ` Dragos Tatulea
2025-11-08 2:04 ` Jakub Kicinski
2025-11-10 12:36 ` Pavel Begunkov
2025-11-10 12:48 ` Dragos Tatulea
2025-11-05 21:56 ` [PATCH net v1 1/2] page_pool: expose max page pool ring size Jesper Dangaard Brouer
2025-11-05 22:56 ` Mina Almasry
2025-11-06 13:12 ` Ilias Apalodimas
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=20251105200801.178381-2-almasrymina@google.com \
--to=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=hramamurthy@google.com \
--cc=ilias.apalodimas@linaro.org \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vedantmathur@google.com \
--cc=willemb@google.com \
--cc=ziweixiao@google.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®