summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-02-20 17:36:19 -0800
committerDave Barach <openvpp@barachs.net>2021-02-22 22:26:31 +0000
commit44fadb0a604b4bbdcb142cec53ddcd356f670900 (patch)
tree7de92692757773a936e0478a530e40534c8a0689
parent0674f85c803b59ada3643bfaeba1b321abeb5d6a (diff)
svm: free shared fifo on detach
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I639560ee3dd0a1d605ec2866dce5cdd13fda8201
-rw-r--r--src/svm/fifo_segment.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index e3e6caaa6cc..ea0352f4835 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -956,6 +956,7 @@ fifo_segment_detach_fifo (fifo_segment_t *fs, svm_fifo_t **f)
fsh_slice_collect_chunks (fs->h, fss, of->chunks_at_attach);
of->chunks_at_attach = 0;
+ fss_fifo_free_list_push (fs->h, fss, of->shr);
clib_mem_bulk_free (pfss->fifos, *f);
*f = 0;
}
@@ -981,6 +982,7 @@ fifo_segment_attach_fifo (fifo_segment_t *fs, svm_fifo_t **f, u32 slice_index)
/* Update allocated chunks for fifo segment and build list of
* chunks to be freed, i.e, returned to old slice at detach */
of = *f;
+ of->shr = fsh_try_alloc_fifo_hdr (fs->h, fss);
c = fs_chunk_ptr (fs->h, nf->shr->start_chunk);
of->chunks_at_attach = pc = fsh_try_alloc_chunk (fs->h, fss, c->length);
@@ -1541,8 +1543,8 @@ format_fifo_segment (u8 * s, va_list * args)
format_memory_size, chunk_bytes, chunk_bytes,
format_memory_size, est_chunk_bytes, est_chunk_bytes,
format_memory_size, tracked_cached_bytes, tracked_cached_bytes);
- s = format (s, "%Ufifo active: %u hdr free bytes: %U (%u) \n",
- format_white_space, indent + 2, fsh->n_active_fifos,
+ s = format (s, "%Ufifo active: %u hdr free: %u bytes: %U (%u) \n",
+ format_white_space, indent + 2, fsh->n_active_fifos, free_fifos,
format_memory_size, fifo_hdr, fifo_hdr);
s = format (s, "%Usegment usage: %.2f%% (%U / %U) virt: %U status: %s\n",
format_white_space, indent + 2, usage, format_memory_size,