OSDN Git Service

xsk: support use vaddr as ring
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>
Thu, 16 Feb 2023 08:30:47 +0000 (16:30 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Feb 2023 08:22:12 +0000 (08:22 +0000)
commit9f78bf330a66cd400b3e00f370f597e9fa939207
tree2d260b0cc0471c30641dadb8ae18cef51bf85b2e
parentb148d400f820637bcc95f6aca64c8763a2db858f
xsk: support use vaddr as ring

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>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/xdp/xsk.c
net/xdp/xsk_queue.c
net/xdp/xsk_queue.h