aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-03-05 20:36:40 +0000
committerDave Barach <openvpp@barachs.net>2020-03-05 21:56:28 +0000
commit05c7317d07b878b8b5795fed5c1593616a1c1fae (patch)
tree80e87443a6b435a301a2539f96d175c6faa5ccab
parent75ccf7b5c51c170da45fb52bd62a6d621923f245 (diff)
session: reduce segment reserved bytes
Type: refactor Rb-trees are no longer maintained in the segment so we don't need to reserve memory. Keeping the option as a means to avoid underlying infra (dlmalloc) and alignment overhead. Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I84741e95d015f7b72c60d9dca20be8e0aee6a915
-rw-r--r--src/svm/fifo_segment.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index 39856a1a333..816f7113fd6 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -116,7 +116,7 @@ fifo_segment_init (fifo_segment_t * fs)
fifo_segment_header_t *fsh;
fifo_segment_slice_t *fss;
ssvm_shared_header_t *sh;
- u32 max_chunk_sz, max_chunks;
+ u32 max_chunk_sz;
uword max_fifo;
void *oldheap;
int i;
@@ -159,8 +159,7 @@ fifo_segment_init (fifo_segment_t * fs)
fsh->n_free_bytes = fsh_free_space (fsh);
fsh->n_cached_bytes = 0;
- max_chunks = fsh->n_free_bytes / FIFO_SEGMENT_MIN_FIFO_SIZE;
- fsh->n_reserved_bytes = (max_chunks / 4) * sizeof (rb_node_t);
+ fsh->n_reserved_bytes = clib_min (0.01 * fsh->n_free_bytes, 256 << 10);
sh->ready = 1;
return (0);
}