From 05c7317d07b878b8b5795fed5c1593616a1c1fae Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 5 Mar 2020 20:36:40 +0000 Subject: 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 Change-Id: I84741e95d015f7b72c60d9dca20be8e0aee6a915 --- src/svm/fifo_segment.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/svm') 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); } -- cgit 1.2.3-korg