Thread (4 messages) flat view 4 messages, 3 authors, 2023-02-20

Re: [PATCH net-next v4] xsk: support use vaddr as ring

From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Date: 2023-02-17 09:01:42
Also in: bpf

On Thu, 16 Feb 2023 14:04:47 +0100, Alexander Lobakin [off-list ref] wrote:
From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Date: Thu, 16 Feb 2023 16:30:47 +0800
quoted
When we try to start AF_XDP on some machines with long running time, due
to the machine's memory fragmentation problem, there is no sufficient
contiguous physical memory that will cause the start failure.

If the size of the queue is 8 * 1024, then the size of the desc[] is
8 * 1024 * 8 = 16 * PAGE, but we also add struct xdp_ring size, so it is
16page+. This is necessary to apply for a 4-order memory. If there are a
lot of queues, it is difficult to these machine with long running time.

Here, that we actually waste 15 pages. 4-Order memory is 32 pages, but
we only use 17 pages.

This patch replaces __get_free_pages() by vmalloc() to allocate memory
to solve these problems.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
---
[...]
quoted
diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h
index c6fb6b763658..bfb2a7e50c26 100644
--- a/net/xdp/xsk_queue.h
+++ b/net/xdp/xsk_queue.h
@@ -45,6 +45,7 @@ struct xsk_queue {
 	struct xdp_ring *ring;
 	u64 invalid_descs;
 	u64 queue_empty_descs;
+	size_t ring_vmalloc_size;
The name looks a bit long to me, but that might be just personal
preference. The code itself now looks good to me.

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
quoted
 };

 /* The structure of the shared state of the rings are a simple
Next time pls make sure you added all of the reviewers to the Cc list
when sending a new revision. I noticed you posted v4 only by monitoring
the ML.
Oh, sorry. I always thought you were in the list. I did not notice this
situation.

I will pay attention next time. Thank you for your reply.

Thanks.

Thanks,
Olek
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help