Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
vlib: fix coverity warning / real bug
[vpp.git]
/
src
/
vppinfra
/
mem_mheap.c
diff --git
a/src/vppinfra/mem_mheap.c
b/src/vppinfra/mem_mheap.c
index
9b2af52
..
0ca0053
100644
(file)
--- a/
src/vppinfra/mem_mheap.c
+++ b/
src/vppinfra/mem_mheap.c
@@
-39,10
+39,6
@@
#include <vppinfra/mheap.h>
#include <vppinfra/os.h>
#include <vppinfra/mheap.h>
#include <vppinfra/os.h>
-/* Valgrind stuff. */
-#include <vppinfra/memcheck.h>
-#include <vppinfra/valgrind.h>
-
void *clib_per_cpu_mheaps[CLIB_MAX_MHEAPS];
void
void *clib_per_cpu_mheaps[CLIB_MAX_MHEAPS];
void
@@
-95,32
+91,24
@@
clib_mem_init (void *memory, uword memory_size)
return heap;
}
return heap;
}
-#ifdef CLIB_LINUX_KERNEL
-#include <asm/page.h>
-
-uword
-clib_mem_get_page_size (void)
+void *
+clib_mem_init_thread_safe (void *memory, uword memory_size)
{
{
- return PAGE_SIZE;
-}
-#endif
+ mheap_t *h;
+ u8 *heap;
-#ifdef CLIB_UNIX
-uword
-clib_mem_get_page_size (void)
-{
- return getpagesize ();
-}
-#endif
+ clib_mem_init (memory, memory_size);
-/* Make a guess for standalone. */
-#ifdef CLIB_STANDALONE
-uword
-clib_mem_get_page_size (void)
-{
- return 4096;
+ heap = clib_mem_get_per_cpu_heap ();
+ ASSERT (heap);
+
+ h = mheap_header (heap);
+
+ /* make the main heap thread-safe */
+ h->flags |= MHEAP_FLAG_THREAD_SAFE;
+
+ return heap;
}
}
-#endif
u8 *
format_clib_mem_usage (u8 * s, va_list * va)
u8 *
format_clib_mem_usage (u8 * s, va_list * va)
@@
-156,6
+144,12
@@
clib_mem_trace (int enable)
mheap_trace (clib_mem_get_heap (), enable);
}
mheap_trace (clib_mem_get_heap (), enable);
}
+int
+clib_mem_is_traced (void)
+{
+ return mheap_is_traced (clib_mem_get_heap ());
+}
+
/*
* fd.io coding-style-patch-verification: ON
*
/*
* fd.io coding-style-patch-verification: ON
*