aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorLukas Stockner <lstockner@genesiscloud.com>2024-06-18 14:52:52 +0200
committerDamjan Marion <dmarion@0xa5.net>2024-08-29 08:40:34 +0000
commitb4808de24779cd0037568cff003b915e25edbdc6 (patch)
tree3d991c2985267d738da5691d0ad77d59d45b7ec8 /src/vlib
parentff17350ae04dd975c139685d01dc4818e50dbdfe (diff)
buffers: support disabling allocation per numa domain
Currently, the per-numa buffer allocation doesn't support skipping the allocation altogether for a particular NUMA domain - if it's set to zero, it instead uses the default allocation. Therefore, this changes the behavior so that the default is only used if no per-numa allocation is specified, and an allocation of zero is honored by not allocating a buffer at all. Type: improvement Change-Id: Ie9133b179a88eb884aa3da921e65292daea0df2d Signed-off-by: Lukas Stockner <lstockner@genesiscloud.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/buffer.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index 5ba42270b1a..71fcfee2190 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -663,6 +663,7 @@ vlib_buffer_main_init_numa_alloc (struct vlib_main_t *vm, u32 numa_node,
u8 unpriv)
{
vlib_buffer_main_t *bm = vm->buffer_main;
+ u32 default_buffers_per_numa = bm->default_buffers_per_numa;
u32 buffers_per_numa = bm->buffers_per_numa[numa_node];
clib_error_t *error;
u32 buffer_size;
@@ -679,12 +680,13 @@ vlib_buffer_main_init_numa_alloc (struct vlib_main_t *vm, u32 numa_node,
return clib_error_return (0, "buffer size (%llu) is greater than page "
"size (%llu)", buffer_size, pagesize);
- if (buffers_per_numa == 0)
- buffers_per_numa = bm->default_buffers_per_numa;
+ if (default_buffers_per_numa == 0)
+ default_buffers_per_numa = unpriv ?
+ VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA_UNPRIV :
+ VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA;
- if (buffers_per_numa == 0)
- buffers_per_numa = unpriv ? VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA_UNPRIV :
- VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA;
+ if (buffers_per_numa == ~0)
+ buffers_per_numa = default_buffers_per_numa;
name = format (0, "buffers-numa-%d%c", numa_node, 0);
n_pages = (buffers_per_numa - 1) / (pagesize / buffer_size) + 1;
@@ -856,6 +858,10 @@ vlib_buffer_main_init (struct vlib_main_t * vm)
{
u8 *index = bm->default_buffer_pool_index_for_numa + numa_node;
index[0] = ~0;
+
+ if (bm->buffers_per_numa[numa_node] == 0)
+ continue;
+
if ((err = vlib_buffer_main_init_numa_node (vm, numa_node, index)))
{
clib_error_report (err);
@@ -912,7 +918,7 @@ static clib_error_t *
vlib_buffers_numa_configure (vlib_buffer_main_t *bm, u32 numa_node,
unformat_input_t *input)
{
- u32 buffers = 0;
+ u32 buffers = ~0;
if (numa_node >= VLIB_BUFFER_MAX_NUMA_NODES)
return clib_error_return (0, "invalid numa node");
@@ -945,7 +951,7 @@ vlib_buffers_configure (vlib_main_t * vm, unformat_input_t * input)
bm = vm->buffer_main;
bm->log2_page_size = CLIB_MEM_PAGE_SZ_UNKNOWN;
- memset (bm->buffers_per_numa, 0, sizeof (bm->buffers_per_numa));
+ memset (bm->buffers_per_numa, ~0, sizeof (bm->buffers_per_numa));
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{