FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
mem.h File Reference
+ Include dependency graph for mem.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  clib_mem_usage_t
 
struct  clib_mem_vm_alloc_t
 
struct  clib_mem_vm_map_t
 

Macros

#define CLIB_MAX_MHEAPS   256
 
#define CLIB_MAX_NUMAS   8
 
#define VEC_NUMA_UNSPECIFIED   (0xFF)
 
#define clib_mem_alloc_aligned_no_fail(size, align)
 
#define clib_mem_alloc_no_fail(size)   clib_mem_alloc_aligned_no_fail(size,1)
 
#define clib_mem_alloc_stack(bytes)   __builtin_alloca(bytes)
 
#define CLIB_MEM_VM_F_SHARED   (1 << 0)
 
#define CLIB_MEM_VM_F_HUGETLB   (1 << 1)
 
#define CLIB_MEM_VM_F_NUMA_PREFER   (1 << 2)
 
#define CLIB_MEM_VM_F_NUMA_FORCE   (1 << 3)
 
#define CLIB_MEM_VM_F_HUGETLB_PREALLOC   (1 << 4)
 
#define CLIB_MEM_VM_F_LOCKED   (1 << 5)
 

Functions

static void * clib_mem_get_per_cpu_heap (void)
 
static void * clib_mem_set_per_cpu_heap (u8 *new_heap)
 
static void * clib_mem_get_per_numa_heap (u32 numa_id)
 
static void * clib_mem_set_per_numa_heap (u8 *new_heap)
 
static void clib_mem_set_thread_index (void)
 
static uword clib_mem_size_nocheck (void *p)
 
static void * clib_mem_alloc_aligned_at_offset (uword size, uword align, uword align_offset, int os_out_of_memory_on_failure)
 
static void * clib_mem_alloc (uword size)
 
static void * clib_mem_alloc_aligned (uword size, uword align)
 
static void * clib_mem_alloc_or_null (uword size)
 
static void * clib_mem_alloc_aligned_or_null (uword size, uword align)
 
static uword clib_mem_is_heap_object (void *p)
 
static void clib_mem_free (void *p)
 
static void * clib_mem_realloc (void *p, uword new_size, uword old_size)
 
static uword clib_mem_size (void *p)
 
static void clib_mem_free_s (void *p)
 
static void * clib_mem_get_heap (void)
 
static void * clib_mem_set_heap (void *heap)
 
void * clib_mem_init (void *heap, uword size)
 
void * clib_mem_init_thread_safe (void *memory, uword memory_size)
 
void * clib_mem_init_thread_safe_numa (void *memory, uword memory_size, u8 numa)
 
void clib_mem_exit (void)
 
uword clib_mem_get_page_size (void)
 
void clib_mem_validate (void)
 
void clib_mem_trace (int enable)
 
int clib_mem_is_traced (void)
 
void clib_mem_usage (clib_mem_usage_t *usage)
 
u8format_clib_mem_usage (u8 *s, va_list *args)
 
static void * clib_mem_vm_alloc (uword size)
 
static void clib_mem_vm_free (void *addr, uword size)
 
static void * clib_mem_vm_unmap (void *addr, uword size)
 
static void * clib_mem_vm_map (void *addr, uword size)
 
clib_error_tclib_mem_create_fd (char *name, int *fdp)
 
clib_error_tclib_mem_create_hugetlb_fd (char *name, int *fdp)
 
clib_error_tclib_mem_vm_ext_alloc (clib_mem_vm_alloc_t *a)
 
void clib_mem_vm_ext_free (clib_mem_vm_alloc_t *a)
 
u64 clib_mem_get_fd_page_size (int fd)
 
uword clib_mem_get_default_hugepage_size (void)
 
int clib_mem_get_fd_log2_page_size (int fd)
 
uword clib_mem_vm_reserve (uword start, uword size, u32 log2_page_sz)
 
u64clib_mem_vm_get_paddr (void *mem, int log2_page_size, int n_pages)
 
void clib_mem_destroy_mspace (void *mspace)
 
void clib_mem_destroy (void)
 
clib_error_tclib_mem_vm_ext_map (clib_mem_vm_map_t *a)
 
void clib_mem_vm_randomize_va (uword *requested_va, u32 log2_page_size)
 
void mheap_trace (void *v, int enable)
 
uword clib_mem_trace_enable_disable (uword enable)
 

Variables

void * clib_per_cpu_mheaps [CLIB_MAX_MHEAPS]
 
void * clib_per_numa_mheaps [CLIB_MAX_NUMAS]
 

Macro Definition Documentation

◆ CLIB_MAX_MHEAPS

#define CLIB_MAX_MHEAPS   256

Definition at line 54 of file mem.h.

◆ CLIB_MAX_NUMAS

#define CLIB_MAX_NUMAS   8

Definition at line 55 of file mem.h.

◆ clib_mem_alloc_aligned_no_fail

#define clib_mem_alloc_aligned_no_fail (   size,
  align 
)
Value:
({ \
uword _clib_mem_alloc_size = (size); \
void * _clib_mem_alloc_p; \
_clib_mem_alloc_p = clib_mem_alloc_aligned (_clib_mem_alloc_size, (align)); \
if (! _clib_mem_alloc_p) \
clib_panic ("failed to allocate %d bytes", _clib_mem_alloc_size); \
_clib_mem_alloc_p; \
})
u32 size
Definition: vhost_user.h:106
static void * clib_mem_alloc_aligned(uword size, uword align)
Definition: mem.h:165

Definition at line 191 of file mem.h.

◆ clib_mem_alloc_no_fail

#define clib_mem_alloc_no_fail (   size)    clib_mem_alloc_aligned_no_fail(size,1)

Definition at line 201 of file mem.h.

◆ clib_mem_alloc_stack

#define clib_mem_alloc_stack (   bytes)    __builtin_alloca(bytes)

Definition at line 204 of file mem.h.

◆ CLIB_MEM_VM_F_HUGETLB

#define CLIB_MEM_VM_F_HUGETLB   (1 << 1)

Definition at line 380 of file mem.h.

◆ CLIB_MEM_VM_F_HUGETLB_PREALLOC

#define CLIB_MEM_VM_F_HUGETLB_PREALLOC   (1 << 4)

Definition at line 383 of file mem.h.

◆ CLIB_MEM_VM_F_LOCKED

#define CLIB_MEM_VM_F_LOCKED   (1 << 5)

Definition at line 384 of file mem.h.

◆ CLIB_MEM_VM_F_NUMA_FORCE

#define CLIB_MEM_VM_F_NUMA_FORCE   (1 << 3)

Definition at line 382 of file mem.h.

◆ CLIB_MEM_VM_F_NUMA_PREFER

#define CLIB_MEM_VM_F_NUMA_PREFER   (1 << 2)

Definition at line 381 of file mem.h.

◆ CLIB_MEM_VM_F_SHARED

#define CLIB_MEM_VM_F_SHARED   (1 << 0)

Definition at line 379 of file mem.h.

◆ VEC_NUMA_UNSPECIFIED

#define VEC_NUMA_UNSPECIFIED   (0xFF)

Definition at line 58 of file mem.h.

Function Documentation

◆ clib_mem_alloc()

static void* clib_mem_alloc ( uword  size)
inlinestatic

Definition at line 157 of file mem.h.

+ Here is the call graph for this function:

◆ clib_mem_alloc_aligned()

static void* clib_mem_alloc_aligned ( uword  size,
uword  align 
)
inlinestatic

Definition at line 165 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_alloc_aligned_at_offset()

static void* clib_mem_alloc_aligned_at_offset ( uword  size,
uword  align,
uword  align_offset,
int  os_out_of_memory_on_failure 
)
inlinestatic

Definition at line 125 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_alloc_aligned_or_null()

static void* clib_mem_alloc_aligned_or_null ( uword  size,
uword  align 
)
inlinestatic

Definition at line 181 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_alloc_or_null()

static void* clib_mem_alloc_or_null ( uword  size)
inlinestatic

Definition at line 173 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_create_fd()

clib_error_t* clib_mem_create_fd ( char *  name,
int *  fdp 
)

Definition at line 126 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_create_hugetlb_fd()

clib_error_t* clib_mem_create_hugetlb_fd ( char *  name,
int *  fdp 
)

Definition at line 146 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_destroy()

void clib_mem_destroy ( void  )

Definition at line 252 of file mem_dlmalloc.c.

+ Here is the call graph for this function:

◆ clib_mem_destroy_mspace()

void clib_mem_destroy_mspace ( void *  mspace)

Definition at line 241 of file mem_dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_exit()

void clib_mem_exit ( void  )
+ Here is the caller graph for this function:

◆ clib_mem_free()

static void clib_mem_free ( void *  p)
inlinestatic

Definition at line 215 of file mem.h.

+ Here is the call graph for this function:

◆ clib_mem_free_s()

static void clib_mem_free_s ( void *  p)
inlinestatic

Definition at line 253 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_get_default_hugepage_size()

uword clib_mem_get_default_hugepage_size ( void  )

Definition at line 57 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_get_fd_log2_page_size()

int clib_mem_get_fd_log2_page_size ( int  fd)

Definition at line 100 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_get_fd_page_size()

u64 clib_mem_get_fd_page_size ( int  fd)

Definition at line 91 of file mem.c.

+ Here is the caller graph for this function:

◆ clib_mem_get_heap()

static void* clib_mem_get_heap ( void  )
inlinestatic

Definition at line 262 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_get_page_size()

uword clib_mem_get_page_size ( void  )

Definition at line 51 of file mem.c.

+ Here is the caller graph for this function:

◆ clib_mem_get_per_cpu_heap()

static void* clib_mem_get_per_cpu_heap ( void  )
inlinestatic

Definition at line 65 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_get_per_numa_heap()

static void* clib_mem_get_per_numa_heap ( u32  numa_id)
inlinestatic

Definition at line 81 of file mem.h.

◆ clib_mem_init()

void* clib_mem_init ( void *  heap,
uword  size 
)

Definition at line 227 of file mem_dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_init_thread_safe()

void* clib_mem_init_thread_safe ( void *  memory,
uword  memory_size 
)

Definition at line 234 of file mem_dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_init_thread_safe_numa()

void* clib_mem_init_thread_safe_numa ( void *  memory,
uword  memory_size,
u8  numa 
)

Definition at line 258 of file mem_dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_is_heap_object()

static uword clib_mem_is_heap_object ( void *  p)
inlinestatic

Definition at line 207 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_is_traced()

int clib_mem_is_traced ( void  )

Definition at line 485 of file mem_dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_realloc()

static void* clib_mem_realloc ( void *  p,
uword  new_size,
uword  old_size 
)
inlinestatic

Definition at line 228 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_set_heap()

static void* clib_mem_set_heap ( void *  heap)
inlinestatic

Definition at line 268 of file mem.h.

+ Here is the call graph for this function:

◆ clib_mem_set_per_cpu_heap()

static void* clib_mem_set_per_cpu_heap ( u8 new_heap)
inlinestatic

Definition at line 72 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_set_per_numa_heap()

static void* clib_mem_set_per_numa_heap ( u8 new_heap)
inlinestatic

Definition at line 88 of file mem.h.

+ Here is the call graph for this function:

◆ clib_mem_set_thread_index()

static void clib_mem_set_thread_index ( void  )
inlinestatic

Definition at line 97 of file mem.h.

+ Here is the caller graph for this function:

◆ clib_mem_size()

static uword clib_mem_size ( void *  p)
inlinestatic

Definition at line 246 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_size_nocheck()

static uword clib_mem_size_nocheck ( void *  p)
inlinestatic

Definition at line 118 of file mem.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_trace()

void clib_mem_trace ( int  enable)

Definition at line 470 of file mem_dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_trace_enable_disable()

uword clib_mem_trace_enable_disable ( uword  enable)

Definition at line 491 of file mem_dlmalloc.c.

+ Here is the caller graph for this function:

◆ clib_mem_usage()

void clib_mem_usage ( clib_mem_usage_t usage)

Definition at line 431 of file mem_dlmalloc.c.

◆ clib_mem_validate()

void clib_mem_validate ( void  )

Definition at line 455 of file mem_dlmalloc.c.

+ Here is the caller graph for this function:

◆ clib_mem_vm_alloc()

static void* clib_mem_vm_alloc ( uword  size)
inlinestatic

Definition at line 319 of file mem.h.

+ Here is the caller graph for this function:

◆ clib_mem_vm_ext_alloc()

clib_error_t* clib_mem_vm_ext_alloc ( clib_mem_vm_alloc_t a)

Definition at line 193 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_vm_ext_free()

void clib_mem_vm_ext_free ( clib_mem_vm_alloc_t a)

Definition at line 337 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_vm_ext_map()

clib_error_t* clib_mem_vm_ext_map ( clib_mem_vm_map_t a)

Definition at line 419 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_vm_free()

static void clib_mem_vm_free ( void *  addr,
uword  size 
)
inlinestatic

Definition at line 338 of file mem.h.

+ Here is the caller graph for this function:

◆ clib_mem_vm_get_paddr()

u64* clib_mem_vm_get_paddr ( void *  mem,
int  log2_page_size,
int  n_pages 
)

Definition at line 380 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_vm_map()

static void* clib_mem_vm_map ( void *  addr,
uword  size 
)
inlinestatic

Definition at line 363 of file mem.h.

◆ clib_mem_vm_randomize_va()

void clib_mem_vm_randomize_va ( uword requested_va,
u32  log2_page_size 
)

Definition at line 106 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_vm_reserve()

uword clib_mem_vm_reserve ( uword  start,
uword  size,
u32  log2_page_sz 
)

Definition at line 348 of file mem.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clib_mem_vm_unmap()

static void* clib_mem_vm_unmap ( void *  addr,
uword  size 
)
inlinestatic

Definition at line 344 of file mem.h.

◆ format_clib_mem_usage()

u8* format_clib_mem_usage ( u8 s,
va_list *  args 
)

Definition at line 282 of file mem_dlmalloc.c.

+ Here is the call graph for this function:

◆ mheap_trace()

void mheap_trace ( void *  v,
int  enable 
)

Definition at line 461 of file mem_dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ clib_per_cpu_mheaps

void* clib_per_cpu_mheaps[CLIB_MAX_MHEAPS]

Definition at line 24 of file mem_dlmalloc.c.

◆ clib_per_numa_mheaps

void* clib_per_numa_mheaps[CLIB_MAX_NUMAS]

Definition at line 25 of file mem_dlmalloc.c.