diff options
author | Damjan Marion <damarion@cisco.com> | 2020-10-06 17:46:06 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2020-10-06 23:47:33 +0200 |
commit | bfa75d6b922ee15d2f0d00999fd36b03a85eda8c (patch) | |
tree | ddd1341db08ae2020c37333d31c949d883ef6bc2 /src/svm | |
parent | ab1a50cf7407e31097b550226c2b6954d6371bea (diff) |
vppinfra: add heap header in front of dlmalloc space
This patch adds smal header in front of dlmalloc space, and it stores
some additional information about the heap.
Immediate benefit of this patch is that we know the underlying page size
si we can display heap page statistics / real memory usage.
Type: improvement
Change-Id: Ibd6989cc2f2f64630ab08734c9552e15029c5f3f
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/svm')
-rw-r--r-- | src/svm/ssvm.c | 3 | ||||
-rw-r--r-- | src/svm/ssvm.h | 4 | ||||
-rw-r--r-- | src/svm/svm.h | 10 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c index 47441eb94df..c030650f9f2 100644 --- a/src/svm/ssvm.c +++ b/src/svm/ssvm.c @@ -362,8 +362,7 @@ ssvm_server_init_private (ssvm_private_t * ssvm) { uword page_size, log2_page_size, rnd_size = 0; ssvm_shared_header_t *sh; - void *oldheap; - u8 *heap; + clib_mem_heap_t *heap, *oldheap; log2_page_size = clib_mem_get_log2_page_size (); if (log2_page_size == 0) diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h index 60ff3e4a2d0..9bd16a9b462 100644 --- a/src/svm/ssvm.h +++ b/src/svm/ssvm.h @@ -142,7 +142,7 @@ ssvm_unlock_non_recursive (ssvm_shared_header_t * h) static inline void * ssvm_push_heap (ssvm_shared_header_t * sh) { - u8 *oldheap; + clib_mem_heap_t *oldheap; oldheap = clib_mem_set_heap (sh->heap); return ((void *) oldheap); } @@ -156,7 +156,7 @@ ssvm_pop_heap (void *oldheap) static inline void * ssvm_mem_alloc (ssvm_private_t * ssvm, uword size) { - u8 *oldheap; + clib_mem_heap_t *oldheap; void *rv; oldheap = clib_mem_set_heap (ssvm->sh->heap); diff --git a/src/svm/svm.h b/src/svm/svm.h index 894c3d95494..8bf561e9a81 100644 --- a/src/svm/svm.h +++ b/src/svm/svm.h @@ -31,7 +31,7 @@ static inline void * svm_mem_alloc (svm_region_t * rp, uword size) { - u8 *oldheap; + clib_mem_heap_t *oldheap; ASSERT (rp->flags & SVM_FLAGS_MHEAP); u8 *rv; @@ -47,7 +47,7 @@ static inline void * svm_mem_alloc_aligned_at_offset (svm_region_t * rp, uword size, uword align, uword offset) { - u8 *oldheap; + clib_mem_heap_t *oldheap; ASSERT (rp->flags & SVM_FLAGS_MHEAP); u8 *rv; @@ -63,7 +63,7 @@ svm_mem_alloc_aligned_at_offset (svm_region_t * rp, static inline void svm_mem_free (svm_region_t * rp, void *ptr) { - u8 *oldheap; + clib_mem_heap_t *oldheap; ASSERT (rp->flags & SVM_FLAGS_MHEAP); pthread_mutex_lock (&rp->mutex); @@ -77,7 +77,7 @@ svm_mem_free (svm_region_t * rp, void *ptr) static inline void * svm_push_pvt_heap (svm_region_t * rp) { - u8 *oldheap; + clib_mem_heap_t *oldheap; oldheap = clib_mem_set_heap (rp->region_heap); return ((void *) oldheap); } @@ -85,7 +85,7 @@ svm_push_pvt_heap (svm_region_t * rp) static inline void * svm_push_data_heap (svm_region_t * rp) { - u8 *oldheap; + clib_mem_heap_t *oldheap; oldheap = clib_mem_set_heap (rp->data_heap); return ((void *) oldheap); } |