![]() |
The ROme OpTimistic Simulator
2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Dynamic Memory Logger and Restorer (DyMeLoR) More...
#include <math.h>
#include <string.h>
#include <core/core.h>
#include <datatypes/bitmap.h>
#include <mm/state.h>
#include <core/timer.h>
Go to the source code of this file.
Data Structures | |
struct | _malloc_area |
This structure let DyMeLoR handle one malloc area (for serving given-size memory requests) More... | |
struct | _malloc_state |
Definition of the memory map. More... | |
struct | segment |
struct | slab_header |
struct | slab_chain |
struct | buddy |
Macros | |
#define | LP_PREALLOCATION_INITIAL_ADDRESS (void *)0x0000008000000000 |
#define | MIN_CHUNK_SIZE 128U |
#define | MAX_CHUNK_SIZE 4194304 |
#define | NUM_AREAS (log2(MAX_CHUNK_SIZE) - log2(MIN_CHUNK_SIZE) + 1) |
#define | MAX_NUM_AREAS (NUM_AREAS * 32) |
#define | MAX_LIMIT_NUM_AREAS MAX_NUM_AREAS |
#define | MIN_NUM_CHUNKS 512 |
#define | MAX_NUM_CHUNKS 4096 |
#define | MAX_LOG_THRESHOLD 1.7 |
#define | MIN_LOG_THRESHOLD 1.7 |
#define | INCREMENTAL_GRANULARITY 50 |
#define | LITTLE_SIZE 32 |
#define | CHECK_SIZE 0.25 |
#define | GET_CACHE_LINE_NUMBER(P) ((unsigned long)((P >> 4) & (CACHE_SIZE - 1))) |
#define | SET_LOG_MODE_BIT(m_area) (((malloc_area*)(m_area))->chunk_size |= (1UL << 0)) |
#define | RESET_LOG_MODE_BIT(m_area) (((malloc_area*)(m_area))->chunk_size &= ~(1UL << 0)) |
#define | CHECK_LOG_MODE_BIT(m_area) (((malloc_area*)(m_area))->chunk_size & (1UL << 0)) |
#define | SET_AREA_LOCK_BIT(m_area) (((malloc_area*)(m_area))->chunk_size |= (1UL << 1)) |
#define | RESET_AREA_LOCK_BIT(m_area) (((malloc_area*)(m_area))->chunk_size &= ~(1UL << 1)) |
#define | CHECK_AREA_LOCK_BIT(m_area) (((malloc_area*)(m_area))->chunk_size & (1UL << 1)) |
#define | UNTAGGED_CHUNK_SIZE(m_area) (((malloc_area*)(m_area))->chunk_size & ~((1UL << 0) | (1UL << 1))) |
#define | POWEROF2(x) (1UL << (1 + (63 - __builtin_clzl((x) - 1)))) |
#define | IS_POWEROF2(x) ((x) != 0 && ((x) & ((x) - 1)) == 0) |
#define | PER_LP_PREALLOCATED_MEMORY (262144L * PAGE_SIZE) |
#define | is_incremental(ckpt) (((malloc_state *)ckpt)->is_incremental == true) |
#define | get_top_pointer(ptr) ((unsigned long long *)((char *)ptr - sizeof(unsigned long long))) |
#define | get_area_top_pointer(ptr) ( (malloc_area **)(*get_top_pointer(ptr)) ) |
#define | get_area(ptr) ( *(get_area_top_pointer(ptr)) ) |
#define | PER_LP_PREALLOCATED_MEMORY (262144L * PAGE_SIZE) |
#define | BUDDY_GRANULARITY PAGE_SIZE |
#define | PAGE_SIZE |
#define | BUDDY_BLOCK_SIZE_EXP 12 |
Typedefs | |
typedef struct _malloc_area | malloc_area |
typedef struct _malloc_state | malloc_state |
Functions | |
void | set_force_full (unsigned int, int) |
void | dirty_mem (void *, int) |
size_t | get_state_size (int) |
size_t | get_log_size (malloc_state *) |
size_t | get_inc_log_size (void *) |
int | get_granularity (void) |
size_t | dirty_size (unsigned int, void *, double *) |
malloc_state * | malloc_state_init (void) |
void * | do_malloc (struct lp_struct *, size_t) |
void | do_free (struct lp_struct *, void *ptr) |
void * | allocate_lp_memory (struct lp_struct *, size_t) |
void | free_lp_memory (struct lp_struct *, void *) |
void * | __wrap_malloc (size_t) |
void | __wrap_free (void *) |
void * | __wrap_realloc (void *, size_t) |
void * | __wrap_calloc (size_t, size_t) |
struct buddy * | buddy_new (size_t requested_size) |
void | buddy_destroy (struct buddy *self) |
void * | allocate_buddy_memory (struct buddy *self, void *base_mem, size_t requested_size) |
void | free_buddy_memory (struct buddy *self, void *base_mem, void *ptr) |
Variables | |
size_t | __page_size |
Dynamic Memory Logger and Restorer (DyMeLoR)
LP's memory manager.
This file is part of ROOT-Sim (ROme OpTimistic Simulator).
ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.
ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Definition in file dymelor.h.
#define PAGE_SIZE |
void* __wrap_calloc | ( | size_t | nmemb, |
size_t | size | ||
) |
This is the wrapper of the real stdlib calloc(). Whenever the application level software calls calloc, the call is redirected to this piece of code which relies on wrap_malloc
nmemb | The number of elements to be allocated |
size | The size of each allocated member |
Definition at line 664 of file dymelor.c.
void __wrap_free | ( | void * | ptr | ) |
This is the wrapper of the real stdlib free(). Whenever the application level software calls free, the call is redirected to this piece of code which will set the chunk in the corresponding malloc_area as not allocated.
For further information, please see the paper: R. Toccaceli, F. Quaglia DyMeLoR: Dynamic Memory Logger and Restorer Library for Optimistic Simulation Objects with Generic Memory Layout Proceedings of the 22nd Workshop on Principles of Advanced and Distributed Simulation 2008
ptr | A memory buffer to be free'd |
Definition at line 589 of file dymelor.c.
void* __wrap_malloc | ( | size_t | size | ) |
This is the wrapper of the real stdlib malloc(). Whenever the application level software calls malloc, the call is redirected to this piece of code which uses the memory preallocated by the DyMeLoR subsystem for serving the request. If the memory in the malloc_area is exhausted, a new one is created, relying on the stdlib malloc. In future releases, this wrapper will be integrated with the Memory Management subsystem, which is not yet ready for production.
size | Size of the allocation |
Definition at line 553 of file dymelor.c.
void* __wrap_realloc | ( | void * | ptr, |
size_t | size | ||
) |
This is the wrapper of the real stdlib realloc(). Whenever the application level software calls realloc, the call is redirected to this piece of code which rely on wrap_malloc
ptr | The pointer to be buffer to be reallocated |
size | The size of the allocation |
Definition at line 615 of file dymelor.c.
struct buddy* buddy_new | ( | size_t | requested_size | ) |
void dirty_mem | ( | void * | base, |
int | size | ||
) |
This function marks a memory chunk as dirty. It is invoked from assembly modules invoked by calls injected by the instrumentor, and from the third-party library wrapper. Invocations from other parts of the kernel should be handled with great care.
base | The initial to the start address of the update |
size | The number of bytes being updated |
void* do_malloc | ( | struct lp_struct * | , |
size_t | |||
) |
size_t get_log_size | ( | malloc_state * | logged_state | ) |
malloc_state* malloc_state_init | ( | void | ) |