47 size_t longest[] __attribute__((aligned(
sizeof(
size_t))));
50 extern size_t __page_size;
51 #define PAGE_SIZE ({ \ 52 if(unlikely(__page_size == 0))\ 53 __page_size = getpagesize();\ 65 uint8_t data[] __attribute__((aligned(
sizeof(
void *))));
70 size_t itemsize, itemcount;
71 size_t slabsize, pages_per_alloc;
72 uint64_t initial_slotmask, empty_slotmask;
73 uintptr_t alignment_mask;
84 #define PER_LP_PREALLOCATED_MEMORY (262144L * PAGE_SIZE) // This should be power of 2 multiplied by a page size. This is 1GB per LP. 85 #define BUDDY_GRANULARITY PAGE_SIZE // This is the smallest chunk released by the buddy in bytes. PER_LP_PREALLOCATED_MEMORY/BUDDY_GRANULARITY must be integer and a power of 2 87 extern bool allocator_init(
void);
88 extern void allocator_fini(
void);
89 extern void segment_init(
void);
91 extern void *get_base_pointer(
GID_t gid);
93 extern void initialize_memory_map(
struct lp_struct *lp);
94 extern void finalize_memory_map(
struct lp_struct *lp);
97 unsigned long num_of_fragments);
98 void buddy_destroy(
struct buddy *);
100 extern struct slab_chain *slab_init(
const size_t itemsize);
101 extern void *slab_alloc(
struct slab_chain *
const sch);
102 extern void slab_free(
struct slab_chain *
const sch,
const void *
const addr);
Core ROOT-Sim functionalities.
Dynamic Memory Logger and Restorer (DyMeLoR)
struct buddy * buddy_new(struct lp_struct *lp, size_t num_of_fragments)
Definition of the memory map.