PPL Logo

conv-core/isomalloc.c File Reference

Go to the source code of this file.

Data Structures

struct  CmiIsomallocBlock
struct  _dllnode
struct  _slotblock
struct  _btreenode
struct  _slotset
struct  _insert_ret_val
struct  _slotblock
struct  _slotset
struct  memRegion_t
struct  _slotmsg
struct  slotOP

Typedefs

typedef struct CmiIsomallocBlock CmiIsomallocBlock
typedef size_t memRange_t
typedef struct _dllnode dllnode
typedef struct _slotblock slotblock
typedef struct _btreenode btreenode
typedef struct _slotset slotset
typedef struct _insert_ret_val insert_ret_val
typedef struct _slotmsg slotmsg
typedef struct slotOP slotOP

Functions

static int read_randomflag (void)
static void * block2pointer (CmiIsomallocBlock *blockHeader)
static CmiIsomallocBlockpointer2block (void *heapBlock)
static void * slot2addr (CmiInt8 slot)
static int slot2pe (CmiInt8 slot)
static CmiInt8 pe2slot (int pe)
static int length2slots (int nBytes)
static int find_list_bin (CmiInt8 nslots)
static dllnodelist_insert (slotset *ss, slotblock *sb)
static void list_delete (slotset *ss, slotblock *sb)
static void list_move (slotset *ss, dllnode *dlln, CmiInt8 old_nslots)
static btreenodecreate_btree_node ()
static slotblockfind_btree_slotblock (btreenode *node, CmiInt8 startslot)
static insert_ret_val btree_insert_int (slotset *ss, btreenode *node, CmiInt8 startslot, CmiInt8 nslots)
static btreenodebtree_insert (slotset *ss, btreenode *node, CmiInt8 startslot, CmiInt8 nslots)
static void btree_delete_int (slotset *ss, btreenode *node, CmiInt8 startslot, slotblock *sb)
static btreenodebtree_delete (slotset *ss, btreenode *node, CmiInt8 startslot)
static slotsetnew_slotset (CmiInt8 startslot, CmiInt8 nslots)
static CmiInt8 get_slots (slotset *ss, CmiInt8 nslots)
static void grab_slots (slotset *ss, CmiInt8 sslot, CmiInt8 nslots)
static void free_slots (slotset *ss, CmiInt8 sslot, CmiInt8 nslots)
static void delete_btree (btreenode *node)
static void delete_list_array (slotset *ss)
static void delete_slotset (slotset *ss)
static void print_btree_node (btreenode *node, int node_num)
static int print_btree_level (btreenode *node, int level, int current_level, int node_num)
static void print_btree_top_down (btreenode *node)
static void print_list_array (slotset *ss)
static void print_slots (slotset *ss)
static void add_slots (slotset *ss, CmiInt8 sslot, CmiInt8 nslots)
static void * disabled_map (int nBytes)
static void disabled_unmap (void *bk)
static void disable_isomalloc (const char *why)
static void * call_mmap_fixed (void *addr, size_t len)
static void * call_mmap_anywhere (size_t len)
static void call_munmap (void *addr, size_t len)
static int init_map (char **argv)
 CpvStaticDeclare (int, zerofd)
static void * call_mmap (void *addr, size_t len, int flags)
 Maps this address with these flags.
static CmiIsomallocBlockmap_slots (CmiInt8 slot, CmiInt8 nslots)
 maps the virtual memory associated with slot using mmap
static void unmap_slots (CmiInt8 slot, CmiInt8 nslots)
static void map_failed (CmiInt8 s, CmiInt8 n)
 CpvStaticDeclare (slotset *, myss)
 CtvDeclare (mempool_type *, threadpool)
void * isomallocfn (size_t *size, mem_handle_t *mem_hndl, int expand_flag)
void isofreefn (void *ptr, mem_handle_t mem_hndl)
static void * __cur_stack_frame (void)
static void * __static_data_loc (void)
static int pointer_lt (const char *a, const char *b)
static int pointer_ge (const char *a, const char *b)
static char * pmin (char *a, char *b)
static char * pmax (char *a, char *b)
static int bad_location (char *loc)
static memRange_t divide_range (memRange_t len, int n)
static int partially_good (char *start, memRange_t len, int n)
static int good_range (char *start, memRange_t len, int n)
static void check_range (char *start, char *end, memRegion_t *max)
static memRegion_t find_free_region (memRegion_t *used, int nUsed, int atLeast)
static int find_largest_free_region (memRegion_t *destRegion)
static int try_largest_mmap_region (memRegion_t *destRegion)
static void init_ranges (char **argv)
static slotmsgprepare_slotmsg (CmiInt8 slot, CmiInt8 nslots)
static void grab_remote (slotmsg *msg)
static void free_remote (slotmsg *msg)
static void init_comm (char **argv)
static void one_slotOP (const slotOP *op, int pe, CmiInt8 s, CmiInt8 n)
static void all_slotOP (const slotOP *op, CmiInt8 s, CmiInt8 n)
void * CmiIsomalloc (int size, CthThread tid)
static void * _isomallocAlign (size_t align, size_t size, size_t reserved, CthThread t)
 return an aligned isomalloc memory, the alignment occurs after the first 'reserved' bytes.
void * CmiIsomallocAlign (size_t align, size_t size, CthThread t)
int CmiIsomallocEnabled ()
void CmiIsomallocPup (pup_er p, void **blockPtrPtr)
void CmiIsomallocFree (void *blockPtr)
CmiInt8 CmiIsomallocLength (void *block)
int CmiIsomallocInRange (void *addr)
void CmiIsomallocInit (char **argv)
static char * Slot_toUser (CmiIsomallocBlockList *s)
static CmiIsomallocBlockListSlot_fmUser (void *s)
CmiIsomallocBlockListCmiIsomallocBlockListNew (CthThread tid)
static void print_myslots ()
void CmiIsomallocBlockListPup (pup_er p, CmiIsomallocBlockList **lp, CthThread tid)
void CmiIsomallocBlockListDelete (CmiIsomallocBlockList *l)
void * CmiIsomallocBlockListMalloc (CmiIsomallocBlockList *l, size_t nBytes)
void * CmiIsomallocBlockListMallocAlign (CmiIsomallocBlockList *l, size_t align, size_t nBytes)
void CmiIsomallocBlockListFree (void *block)

Variables

int cutOffPoints [cutOffNum]
static int _sync_iso = 0
static int _restart = 0
static int _mmap_probe = 0
static size_t slotsize
static size_t regionSize
static CmiInt8 numslots = 0
static char * isomallocStart = NULL
static char * isomallocEnd = NULL
static int disabled_map_warned = 0
static const memRange_t meg = 1024u*1024u
static const memRange_t gig = 1024u*1024u*1024u
static int grab_remote_idx
static int free_remote_idx
static slotOP grabOP
static slotOP freeOP


Typedef Documentation

Definition at line 101 of file isomalloc.c.

typedef size_t memRange_t

Definition at line 112 of file isomalloc.c.

typedef struct _dllnode dllnode

Definition at line 167 of file isomalloc.c.

typedef struct _slotblock slotblock

Definition at line 168 of file isomalloc.c.

typedef struct _btreenode btreenode

Definition at line 176 of file isomalloc.c.

typedef struct _slotset slotset

typedef struct _slotmsg slotmsg

typedef struct slotOP slotOP

Definition at line 2291 of file isomalloc.c.


Function Documentation

static int read_randomflag ( void   )  [static]

Definition at line 74 of file isomalloc.c.

Referenced by CmiIsomallocInit().

static void* block2pointer ( CmiIsomallocBlock blockHeader  )  [static]

Definition at line 104 of file isomalloc.c.

Referenced by CmiIsomalloc(), and CmiIsomallocPup().

static CmiIsomallocBlock* pointer2block ( void *  heapBlock  )  [static]

static void* slot2addr ( CmiInt8  slot  )  [static]

Definition at line 128 of file isomalloc.c.

References isomallocStart, and slotsize.

Referenced by map_failed(), map_slots(), and unmap_slots().

static int slot2pe ( CmiInt8  slot  )  [static]

Definition at line 131 of file isomalloc.c.

References numslots.

Referenced by all_slotOP().

static CmiInt8 pe2slot ( int  pe  )  [static]

Definition at line 134 of file isomalloc.c.

References numslots.

Referenced by init_ranges(), and one_slotOP().

static int length2slots ( int  nBytes  )  [static]

Definition at line 139 of file isomalloc.c.

References slotsize.

Referenced by CmiIsomalloc(), CmiIsomallocFree(), CmiIsomallocPup(), and isomallocfn().

static int find_list_bin ( CmiInt8  nslots  )  [static]

Definition at line 196 of file isomalloc.c.

Referenced by get_slots(), list_delete(), list_insert(), list_move(), and new_slotset().

static dllnode* list_insert ( slotset ss,
slotblock sb 
) [static]

static void list_delete ( slotset ss,
slotblock sb 
) [static]

static void list_move ( slotset ss,
dllnode dlln,
CmiInt8  old_nslots 
) [static]

static btreenode* create_btree_node (  )  [static]

static slotblock* find_btree_slotblock ( btreenode node,
CmiInt8  startslot 
) [static]

static insert_ret_val btree_insert_int ( slotset ss,
btreenode node,
CmiInt8  startslot,
CmiInt8  nslots 
) [static]

static btreenode* btree_insert ( slotset ss,
btreenode node,
CmiInt8  startslot,
CmiInt8  nslots 
) [static]

static void btree_delete_int ( slotset ss,
btreenode node,
CmiInt8  startslot,
slotblock sb 
) [static]

static btreenode* btree_delete ( slotset ss,
btreenode node,
CmiInt8  startslot 
) [static]

Definition at line 944 of file isomalloc.c.

References btree_delete_int(), _btreenode::child, free_reentrant(), and _btreenode::num_blocks.

Referenced by free_slots(), and grab_slots().

static slotset * new_slotset ( CmiInt8  startslot,
CmiInt8  nslots 
) [static]

static CmiInt8 get_slots ( slotset ss,
CmiInt8  nslots 
) [static]

static void grab_slots ( slotset ss,
CmiInt8  sslot,
CmiInt8  nslots 
) [static]

static void free_slots ( slotset ss,
CmiInt8  sslot,
CmiInt8  nslots 
) [static]

static void delete_btree ( btreenode node  )  [static]

Definition at line 1145 of file isomalloc.c.

References _btreenode::child, free_reentrant(), and _btreenode::num_blocks.

Referenced by delete_btree(), and delete_slotset().

static void delete_list_array ( slotset ss  )  [static]

Definition at line 1161 of file isomalloc.c.

References free_reentrant(), _slotset::list_array, _dllnode::next, and _dllnode::previous.

Referenced by delete_slotset().

static void delete_slotset ( slotset ss  )  [static]

static void print_btree_node ( btreenode node,
int  node_num 
) [static]

static int print_btree_level ( btreenode node,
int  level,
int  current_level,
int  node_num 
) [static]

static void print_btree_top_down ( btreenode node  )  [static]

Definition at line 1224 of file isomalloc.c.

References CmiPrintf(), level, and print_btree_level().

Referenced by print_slots().

static void print_list_array ( slotset ss  )  [static]

static void print_slots ( slotset ss  )  [static]

Definition at line 1262 of file isomalloc.c.

References _slotset::btree_root, print_btree_top_down(), and print_list_array().

Referenced by print_myslots().

static void add_slots ( slotset ss,
CmiInt8  sslot,
CmiInt8  nslots 
) [static]

static void* disabled_map ( int  nBytes  )  [static]

Definition at line 1486 of file isomalloc.c.

References CmiError(), CmiMyPe(), and malloc().

Referenced by CmiIsomalloc().

static void disabled_unmap ( void *  bk  )  [static]

Definition at line 1496 of file isomalloc.c.

References free().

Referenced by CmiIsomallocFree().

static void disable_isomalloc ( const char *  why  )  [static]

Definition at line 1501 of file isomalloc.c.

References CmiMyPe(), CmiPrintf(), isomallocEnd, and isomallocStart.

Referenced by CmiIsomallocInit(), and init_ranges().

static void * call_mmap_fixed ( void *  addr,
size_t  len 
) [static]

Definition at line 1511 of file isomalloc.c.

References CmiAbort().

Referenced by bad_location(), and map_slots().

static void * call_mmap_anywhere ( size_t  len  )  [static]

Definition at line 1515 of file isomalloc.c.

References CmiAbort().

Referenced by find_largest_free_region().

static void call_munmap ( void *  addr,
size_t  len 
) [static]

static int init_map ( char **  argv  )  [static]

Definition at line 1524 of file isomalloc.c.

Referenced by CmiIsomallocInit().

CpvStaticDeclare ( int  ,
zerofd   
)

static void* call_mmap ( void *  addr,
size_t  len,
int  flags 
) [static]

Maps this address with these flags.

Definition at line 1542 of file isomalloc.c.

static CmiIsomallocBlock* map_slots ( CmiInt8  slot,
CmiInt8  nslots 
) [static]

maps the virtual memory associated with slot using mmap

Definition at line 1589 of file isomalloc.c.

References call_mmap_fixed(), call_munmap(), CmiMyPe(), CmiPrintf(), slot2addr(), and slotsize.

Referenced by CmiIsomalloc(), CmiIsomallocBlockListPup(), CmiIsomallocPup(), and isomallocfn().

static void unmap_slots ( CmiInt8  slot,
CmiInt8  nslots 
) [static]

Definition at line 1622 of file isomalloc.c.

References call_munmap(), CmiMyPe(), CmiPrintf(), slot2addr(), and slotsize.

Referenced by CmiIsomallocFree(), and CmiIsomallocPup().

static void map_failed ( CmiInt8  s,
CmiInt8  n 
) [static]

Definition at line 1632 of file isomalloc.c.

References CmiAbort(), CmiError(), errno, slot2addr(), and slotsize.

Referenced by CmiIsomalloc(), CmiIsomallocPup(), and isomallocfn().

CpvStaticDeclare ( slotset ,
myss   
)

CtvDeclare ( mempool_type ,
threadpool   
)

void* isomallocfn ( size_t *  size,
mem_handle_t mem_hndl,
int  expand_flag 
)

void isofreefn ( void *  ptr,
mem_handle_t  mem_hndl 
)

Definition at line 1678 of file isomalloc.c.

References call_munmap(), and size.

Referenced by CmiIsomalloc().

static void* __cur_stack_frame ( void   )  [static]

Definition at line 1692 of file isomalloc.c.

Referenced by find_largest_free_region().

static void* __static_data_loc ( void   )  [static]

Definition at line 1699 of file isomalloc.c.

Referenced by find_largest_free_region().

static int pointer_lt ( const char *  a,
const char *  b 
) [static]

Definition at line 1708 of file isomalloc.c.

Referenced by CmiIsomallocInRange(), find_free_region(), pmax(), and pmin().

static int pointer_ge ( const char *  a,
const char *  b 
) [static]

Definition at line 1711 of file isomalloc.c.

Referenced by CmiIsomallocInRange().

static char* pmin ( char *  a,
char *  b 
) [static]

Definition at line 1715 of file isomalloc.c.

References pointer_lt().

Referenced by check_range(), and find_free_region().

static char* pmax ( char *  a,
char *  b 
) [static]

Definition at line 1716 of file isomalloc.c.

References pointer_lt().

Referenced by find_free_region().

static int bad_location ( char *  loc  )  [static]

Definition at line 1724 of file isomalloc.c.

References call_mmap_fixed(), call_munmap(), CmiMyPe(), CmiPrintf(), and slotsize.

Referenced by good_range(), and partially_good().

static memRange_t divide_range ( memRange_t  len,
int  n 
) [static]

Definition at line 1738 of file isomalloc.c.

Referenced by check_range(), good_range(), and partially_good().

static int partially_good ( char *  start,
memRange_t  len,
int  n 
) [static]

Definition at line 1743 of file isomalloc.c.

References bad_location(), and divide_range().

Referenced by check_range().

static int good_range ( char *  start,
memRange_t  len,
int  n 
) [static]

Definition at line 1754 of file isomalloc.c.

References bad_location(), CmiPrintf(), and divide_range().

Referenced by check_range(), and try_largest_mmap_region().

static void check_range ( char *  start,
char *  end,
memRegion_t max 
) [static]

static memRegion_t find_free_region ( memRegion_t used,
int  nUsed,
int  atLeast 
) [static]

static int find_largest_free_region ( memRegion_t destRegion  )  [static]

static int try_largest_mmap_region ( memRegion_t destRegion  )  [static]

Definition at line 1947 of file isomalloc.c.

References call_munmap(), CmiMyPe(), CmiPrintf(), good_range(), memRegion_t::len, s, size, and memRegion_t::start.

Referenced by init_ranges().

static void init_ranges ( char **  argv  )  [static]

static slotmsg* prepare_slotmsg ( CmiInt8  slot,
CmiInt8  nslots 
) [static]

Definition at line 2263 of file isomalloc.c.

References CmiAlloc(), CmiMyPe(), _slotmsg::nslots, _slotmsg::pe, and _slotmsg::slot.

Referenced by one_slotOP().

static void grab_remote ( slotmsg msg  )  [static]

Definition at line 2272 of file isomalloc.c.

References CmiFree(), grab_slots(), _slotmsg::nslots, and _slotmsg::slot.

Referenced by init_comm().

static void free_remote ( slotmsg msg  )  [static]

Definition at line 2278 of file isomalloc.c.

References CmiFree(), free_slots(), _slotmsg::nslots, and _slotmsg::slot.

Referenced by init_comm().

static void init_comm ( char **  argv  )  [static]

static void one_slotOP ( const slotOP op,
int  pe,
CmiInt8  s,
CmiInt8  n 
) [static]

static void all_slotOP ( const slotOP op,
CmiInt8  s,
CmiInt8  n 
) [static]

Definition at line 2331 of file isomalloc.c.

References one_slotOP(), and slot2pe().

Referenced by CmiIsomallocFree(), and CmiIsomallocPup().

void* CmiIsomalloc ( int  size,
CthThread  tid 
)

static void* _isomallocAlign ( size_t  align,
size_t  size,
size_t  reserved,
CthThread  t 
) [static]

return an aligned isomalloc memory, the alignment occurs after the first 'reserved' bytes.

Total requested size is (size+reserved)

Definition at line 2403 of file isomalloc.c.

References CmiIsomalloc(), pointer2block(), ptr, and s.

Referenced by CmiIsomallocAlign(), and CmiIsomallocBlockListMallocAlign().

void* CmiIsomallocAlign ( size_t  align,
size_t  size,
CthThread  t 
)

Definition at line 2431 of file isomalloc.c.

References _isomallocAlign().

Referenced by allocNewTLSSeg().

int CmiIsomallocEnabled (  ) 

Definition at line 2436 of file isomalloc.c.

References isomallocStart.

Referenced by checkAddress().

void CmiIsomallocPup ( pup_er  p,
void **  blockPtrPtr 
)

void CmiIsomallocFree ( void *  blockPtr  ) 

CmiInt8 CmiIsomallocLength ( void *  block  ) 

Definition at line 2505 of file isomalloc.c.

References CmiIsomallocBlock::length, and pointer2block().

Referenced by meta_realloc().

int CmiIsomallocInRange ( void *  addr  ) 

Definition at line 2511 of file isomalloc.c.

References isomallocEnd, isomallocStart, pointer_ge(), and pointer_lt().

Referenced by checkAddress(), meta_free(), and meta_realloc().

static char* Slot_toUser ( CmiIsomallocBlockList s  )  [static]

static CmiIsomallocBlockList* Slot_fmUser ( void *  s  )  [static]

Definition at line 2569 of file isomalloc.c.

Referenced by CmiIsomallocBlockListFree(), CmiMemoryMarkBlock(), and meta_realloc().

CmiIsomallocBlockList* CmiIsomallocBlockListNew ( CthThread  tid  ) 

static void print_myslots (  )  [static]

Definition at line 2791 of file isomalloc.c.

References CmiMyPe(), CmiPrintf(), and print_slots().

void CmiIsomallocBlockListPup ( pup_er  p,
CmiIsomallocBlockList **  lp,
CthThread  tid 
)

void CmiIsomallocBlockListDelete ( CmiIsomallocBlockList l  ) 

void* CmiIsomallocBlockListMalloc ( CmiIsomallocBlockList l,
size_t  nBytes 
)

void* CmiIsomallocBlockListMallocAlign ( CmiIsomallocBlockList l,
size_t  align,
size_t  nBytes 
)

void CmiIsomallocBlockListFree ( void *  block  ) 


Variable Documentation

int cutOffPoints[cutOffNum]

Definition at line 33 of file mempool.c.

int _sync_iso = 0 [static]

Definition at line 68 of file isomalloc.c.

int _restart = 0 [static]

Definition at line 70 of file isomalloc.c.

int _mmap_probe = 0 [static]

Definition at line 72 of file isomalloc.c.

size_t slotsize [static]

size_t regionSize [static]

Definition at line 116 of file isomalloc.c.

CmiInt8 numslots = 0 [static]

Definition at line 119 of file isomalloc.c.

Referenced by init_ranges(), pe2slot(), and slot2pe().

char* isomallocStart = NULL [static]

char* isomallocEnd = NULL [static]

Definition at line 125 of file isomalloc.c.

Referenced by CmiIsomallocInRange(), disable_isomalloc(), and init_ranges().

int disabled_map_warned = 0 [static]

Definition at line 1485 of file isomalloc.c.

const memRange_t meg = 1024u*1024u [static]

Definition at line 1718 of file isomalloc.c.

const memRange_t gig = 1024u*1024u*1024u [static]

Definition at line 1719 of file isomalloc.c.

int grab_remote_idx [static]

Definition at line 2283 of file isomalloc.c.

int free_remote_idx [static]

Definition at line 2283 of file isomalloc.c.

slotOP grabOP [static]

Definition at line 2292 of file isomalloc.c.

slotOP freeOP [static]

Definition at line 2292 of file isomalloc.c.


Generated on Sat May 26 08:08:07 2012 for Charm++ by  doxygen 1.5.5