 |
NVMLib
very early alpha
A library to optimally use a Hybrid RAM setup.
|
Go to the documentation of this file.
6 #include <libiberty/splay-tree.h>
33 return D_RO(slot)->end_b - D_RO(slot)->start_b + 1;
54 printf(
"allot_free_slot_offset_pool temp_ptr->pool_id %d\n", temp_ptr->
key);
58 printf(
"affop find = %d\n", hmret);
62 printf(
"fhead value is %p\n", f_head);
69 ret = D_RO(node)->start_b;
73 ret = D_RO(node)->start_b;
74 uint64_t new_start = D_RO(node)->start_b + size;
76 printf(
"Allot flag 2\n");
78 TX_BEGIN(temp_ptr->
pool) {
79 D_RW(node)->start_b = new_start;
86 TX_BEGIN(temp_ptr->
pool) {
106 printf(
"allot_frst_free_offset num_pools = %d\n",
num_pools);
202 MEMoidKey _memalloc(
size_t size,
const char *file,
const char *func,
const int line,
int num_args, ...) {
205 + line) % __UINT64_MAX__;
209 va_start(arg_list, num_args);
211 which_ram = va_arg(arg_list,
int);
217 printf(
"\n------------------------------------\nmemalloc: oid->pool_id = %ld, oid->offset = %ld\n------------------------------------------------\n", oid.
pool_id, oid.
offset);
224 printf(
"memalloc: Creating new object or it was previously in DRAM\n");
244 printf(
"memalloc: Object already existing and is from NVRAM\n");
268 TAILQ_INSERT_TAIL(&addition_queue_head, to_add, list);
368 to_del->
key = found_obj->
key;
369 to_del->
oid = found_obj->
oid;
372 TAILQ_INSERT_TAIL(&deletion_queue_head, to_del, list);
381 #define MEMOID_FIRST(m) (get_pool_from_poolid(m.pool_id) + m.offset) //need to use this in object_maintenence.c also, move to malloc.h?
382 #define MEMOID_LAST(m) (get_pool_from_poolid(m.pool_id) + m.offset + m.size)
432 printf(
"Something wrong.\n");
void * get_memobj_direct(MEMoid oid)
The function to return the actual memptr for a given MEMoid object.
#define POBJ_TAILQ_REMOVE_FREE(head, elm, field)
void * _key_get_last(MEMoidKey key)
pool_free_slot_head * head
uintptr_t get_pool_from_poolid(uint64_t pool_id)
void insert_object_to_hashmap(MEMoidKey key, MEMoid oid)
void _memfree(MEMoidKey oidkey)
The fucntion to free the allocated memory location.
void * _key_get_first(MEMoidKey key)
The struct that stores the memptr for the object.
splay_tree addr2MemOID_write
uint64_t MEMoidKey
The key of the HashTable that contains <MEMoidKey, MEMoid>.
MEMoid allot_first_free_offset(size_t size)
Allocates the first free memory chunk of the given size.
MEMoidKey _memalloc(size_t size, const char *file, const char *func, const int line, int num_args,...)
Allocates the memory requested and returns a MEMoidKey.
uint64_t string_hash(const char *str)
#define ANY_RAM
Types of allocation.
uint64_t free_slot_size(TOID(struct pool_free_slot) slot)
splay_tree addr2MemOID_read
void remove_object_from_hashmap(MEMoidKey key)
int addr2memoid_cmp(splay_tree_key key1, splay_tree_key key2)
The compare function used by the splay_tree.
object_maintainance * create_new_maintainance_map_entry(MEMoidKey key, MEMoid oid, where_t which_ram, bool can_be_moved)
object_maintainance * find_in_maintainance_map(MEMoidKey key)
static uint64_t hash(const TOID(struct hashmap_tx) *hashmap, const TOID(struct buckets) *buckets, uint64_t value)
The hash function.
uv_mutex_t read_splay_tree_mutex
The mutex used during manupulation of read splay tree
struct pool_free_slot_head pool_free_slot_head
void create_new_pool(size_t size)
void insert_into_maintainance_map(object_maintainance *obj)
uv_mutex_t object_maintainence_maintain_map_mutex
The mutex used during manupulation of maintainance map
static const MEMoid MEMOID_NULL
Just a dummy obj.
The structure used by the logistics thread for keeping track of the object state in order to make dif...
uv_mutex_t write_splay_tree_mutex
The mutex used during manupulation of read splay tree
#define NVRAM_HEAP
Types of allocation.
unsigned long int uintptr_t
void addr2memoid_del(splay_tree_key key)
uv_mutex_t object_maintainence_addtion_mutex
The mutex used during manupulation of maintainance map
#define POBJ_TAILQ_FOREACH(var, head, field)
#define DRAM_HEAP
Types of allocation.
MEMoid __memalloc(size_t size, int which_ram)
Allocates the memory requested and returns a MEMoid.
uint64_t allot_first_free_offset_pool(uint64_t pool_id, size_t size)
Allocates first free memory chunk of the given size in the given pool specified by pool_id.
#define POOL_ID_MALLOC_OBJ
The structure used in spaly_tree which used for getting MEMoid from the memory address.
#define HASH_MAP_FIND(VALUE_TYPE)
MEMoid get_MEMoid(MEMoidKey key)
The function to obtain the MEMoid object given the MEMoidKey
int decide_allocation(size_t size)
Function to decide the initial allocation of object.
uv_mutex_t object_maintainence_hashmap_mutex
The mutex used during manupulation of types map