![]() |
Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
|
Go to the source code of this file.
Data Structures | |
struct | arch_alloc_s |
struct | arch_alloc_stats_s |
Macros | |
#define | arch_alloc_free(ALLOC, MEM) |
Typedefs | |
typedef void * | arch_alloc_state |
Functions | |
int | arch_alloc_init_once (arch_alloc_s *alloc, size_t size) |
void | arch_alloc_init_always (arch_alloc_s *alloc) |
void * | arch_alloc_allocate (arch_alloc_s *alloc, size_t size) |
void | _arch_alloc_free (arch_alloc_s *alloc, void *mem) |
void | arch_alloc_exit (arch_alloc_s *alloc) |
arch_alloc_stats_s | arch_alloc_stats (arch_alloc_s *alloc) |
void | arch_alloc_inspect (arch_alloc_s *alloc, void(*inspector)(void *start, void *end, size_t size, void *arg), void *arg) |
void * | arax_mmap (size_t s) |
void * | arax_ummap (void *a, size_t s) |
arch_alloc_s * | arch_alloc_create_sub_alloc (arch_alloc_s *parent) |
utils_bitmap_s * | arch_alloc_get_bitmap () |
#define arch_alloc_free | ( | ALLOC, | |
MEM ) |
Free previously allocated memory from a arch_alloc_s instance.
alloc | An initialized arch_alloc_s instance. |
mem | A pointer returned from arch_alloc_allocate. |
Definition at line 70 of file alloc.h.
Referenced by arax_object_ref_dec(), arax_object_ref_dec_pre_locked(), arax_object_rename(), and async_semaphore_dec().
typedef void* arch_alloc_state |
void _arch_alloc_free | ( | arch_alloc_s * | alloc, |
void * | mem ) |
Definition at line 83 of file dlmalloc/alloc.c.
References arch_alloc_inner_s::lock, arch_alloc_inner_s::root, arch_alloc_inner_s::start, utils_spinlock_lock, utils_spinlock_unlock, utils_timer_get_duration_ns, and utils_timer_set.
void * arax_mmap | ( | size_t | s | ) |
Allocate enough pages(4096 bytes) to hold s
bytes.
s | Number of bytes requested (has to be multiple of BIT_ALLOCATOR_BLOCK) |
Definition at line 143 of file dlmalloc/alloc.c.
References arax_assert, BIT_ALLOCATOR_BLOCK, BIT_ALLOCATOR_BLOCK_MASK, BITMAP_NOT_FOUND, global_alloc, and utils_bitmap_alloc_bits().
void * arax_ummap | ( | void * | a, |
size_t | s ) |
Release the pages starting from a
and ending after bytes
a | Pointer returned from a call of arax_mmap() . |
s | Number of bytes to be freed (has to be multiple of BIT_ALLOCATOR_BLOCK) |
Definition at line 154 of file dlmalloc/alloc.c.
References BIT_ALLOCATOR_BLOCK, global_alloc, arch_alloc_inner_s::start, and utils_bitmap_free_bits().
void * arch_alloc_allocate | ( | arch_alloc_s * | alloc, |
size_t | size ) |
Allocate contiguous memory from the alloc arch_alloc_s instance.
alloc | An initialized arch_alloc_s instance. |
size | The size of the allocation. |
Definition at line 62 of file dlmalloc/alloc.c.
References arch_alloc_inner_s::lock, arch_alloc_inner_s::root, arch_alloc_inner_s::start, utils_spinlock_lock, utils_spinlock_unlock, utils_timer_get_duration_ns, and utils_timer_set.
Referenced by arax_object_register(), arax_object_rename(), arax_plot_register_metric(), arch_alloc_create_sub_alloc(), and async_semaphore_dec().
arch_alloc_s * arch_alloc_create_sub_alloc | ( | arch_alloc_s * | parent | ) |
Create a sub-allocator.
This allocator user the same global bitmap for requesting bulk allocations, but maintains separate metadata from the 'global' allocator.
Use arch_alloc_free()
, arch_alloc_allocate()
to alloc/free memory.
Returned allocator should be eventually released by calling arch_alloc_exit()
parent | allocator |
Definition at line 163 of file dlmalloc/alloc.c.
References arch_alloc_allocate(), and arch_alloc_inner_s::root.
void arch_alloc_exit | ( | arch_alloc_s * | alloc | ) |
Release any resources claimed by the alloc arch_alloc_s instance.
Definition at line 102 of file dlmalloc/alloc.c.
References arch_alloc_inner_s::root.
Referenced by arax_pipe_exit().
utils_bitmap_s * arch_alloc_get_bitmap | ( | ) |
Definition at line 172 of file dlmalloc/alloc.c.
References global_alloc.
void arch_alloc_init_always | ( | arch_alloc_s * | alloc | ) |
Perform necessary initialization for every arax application.
arch_alloc_init_once
alloc |
Definition at line 57 of file dlmalloc/alloc.c.
References global_alloc.
Referenced by arax_pipe_init().
int arch_alloc_init_once | ( | arch_alloc_s * | alloc, |
size_t | size ) |
Initialize a arch_alloc_s instance on a mapped shared memory segment.
alloc | Pointer to be filled with initialized instance. |
size | The size of the shared memory segment in bytes. |
Definition at line 27 of file dlmalloc/alloc.c.
References BIT_ALLOCATOR_BLOCK, BIT_ALLOCATOR_BLOCK_MASK, BITS_PER_PAGE, arch_alloc_inner_s::bmp, global_alloc, arch_alloc_inner_s::lock, arch_alloc_inner_s::root, arch_alloc_inner_s::start, utils_bitmap_init(), and utils_spinlock_init.
Referenced by arax_pipe_init().
void arch_alloc_inspect | ( | arch_alloc_s * | alloc, |
void(* | inspector )(void *start, void *end, size_t size, void *arg), | ||
void * | arg ) |
Definition at line 135 of file dlmalloc/alloc.c.
References inspect_walker_state::arg, inspect_walker(), inspect_walker_state::inspector, and arch_alloc_inner_s::root.
arch_alloc_stats_s arch_alloc_stats | ( | arch_alloc_s * | alloc | ) |
Definition at line 117 of file dlmalloc/alloc.c.
References _arch_alloc_mspace_mallinfo(), and arch_alloc_inner_s::root.