memory.c File Reference

Go to the source code of this file.

Classes

struct  ddekit_pcache
struct  ddekit_slab

Functions

void ddekit_slab_setup_page_cache (unsigned pages)
 Setup page cache for all slabs.
static struct ddekit_pcache_try_from_cache (int contig)
 Try to allocate a new page from the pcache.
static void _add_to_cache (struct ddekit_pcache *entry, int contig)
static void _free_cache_entry (struct ddekit_pcache *entry, int contig)
 Return free entry to cached entry list.
static struct ddekit_pcache_get_free_cache_entry (int contig)
static struct ddekit_slabddekit_slab_from_l4slab (l4slab_cache_t *s)
 Get the ddekit slab for a given L4 slab.
static void * _slab_grow (l4slab_cache_t *cache, void **data)
 Grow slab cache.
static void _slab_shrink (l4slab_cache_t *cache, void *page, void *data)
 Shrink slab cache.
void * ddekit_slab_alloc (struct ddekit_slab *slab)
 Allocate object in slab.
void ddekit_slab_free (struct ddekit_slab *slab, void *objp)
 Free object in slab.
void ddekit_slab_set_data (struct ddekit_slab *slab, void *data)
 Store user pointer in slab cache.
void * ddekit_slab_get_data (struct ddekit_slab *slab)
 Read user pointer from slab cache.
void ddekit_slab_destroy (struct ddekit_slab *slab)
 Destroy slab cache.
struct ddekit_slabddekit_slab_init (unsigned size, int contiguous)
 Initialize slab cache.
void ddekit_large_free (void *objp)
 Free large block of memory.
void * ddekit_large_malloc (int size)
 Allocate large block of memory.
void * ddekit_contig_malloc (unsigned long size, unsigned long low, unsigned long high, unsigned long alignment, unsigned long boundary)
 Allocate large block of memory (special interface).

Variables

static struct ddekit_pcachepcache_used
static struct ddekit_pcachepcache_free
static struct ddekit_pcachepcache_used_contig
static struct ddekit_pcachepcache_free_contig
static l4_uint32_t pcache_num_entries = 1


Function Documentation

static void _add_to_cache ( struct ddekit_pcache entry,
int  contig 
) [inline, static]

Definition at line 130 of file ddekit/src/memory.c.

static void _free_cache_entry ( struct ddekit_pcache entry,
int  contig 
) [inline, static]

Return free entry to cached entry list.

Definition at line 142 of file ddekit/src/memory.c.

static struct ddekit_pcache* _get_free_cache_entry ( int  contig  )  [static, read]

Definition at line 152 of file ddekit/src/memory.c.

static void* _slab_grow ( l4slab_cache_t *  cache,
void **  data 
) [static]

Grow slab cache.

Definition at line 198 of file ddekit/src/memory.c.

static void _slab_shrink ( l4slab_cache_t *  cache,
void *  page,
void *  data 
) [static]

Shrink slab cache.

Definition at line 256 of file ddekit/src/memory.c.

static struct ddekit_pcache* _try_from_cache ( int  contig  )  [static, read]

Try to allocate a new page from the pcache.

Definition at line 115 of file ddekit/src/memory.c.

void* ddekit_contig_malloc ( unsigned long  size,
unsigned long  low,
unsigned long  high,
unsigned long  alignment,
unsigned long  boundary 
)

Allocate large block of memory (special interface).

FIXME contig_malloc() is the lowest-level allocator interface one could implement.

This is no useful for allocation < page size.

FIXME implementation missing...

Definition at line 431 of file ddekit/src/memory.c.

void ddekit_large_free ( void *  objp  ) 

Free large block of memory.

Free large memory block.

This is no useful for allocation < page size.

Definition at line 381 of file ddekit/src/memory.c.

void* ddekit_large_malloc ( int  size  ) 

Allocate large block of memory.

Allocate large memory block.

This is no useful for allocation < page size.

Definition at line 396 of file ddekit/src/memory.c.

void* ddekit_slab_alloc ( struct ddekit_slab slab  ) 

Allocate object in slab.

Allocate slab in slab cache.

Definition at line 292 of file ddekit/src/memory.c.

void ddekit_slab_destroy ( struct ddekit_slab slab  ) 

Destroy slab cache.

Parameters:
slab pointer to slab cache structure

Definition at line 337 of file ddekit/src/memory.c.

void ddekit_slab_free ( struct ddekit_slab slab,
void *  objp 
)

Free object in slab.

Deallocate slab in slab cache.

Definition at line 306 of file ddekit/src/memory.c.

static struct ddekit_slab* ddekit_slab_from_l4slab ( l4slab_cache_t *  s  )  [static, read]

Get the ddekit slab for a given L4 slab.

We cheat here, because we know that the L4 slab is the first member of the ddekit slab.

Definition at line 190 of file ddekit/src/memory.c.

void* ddekit_slab_get_data ( struct ddekit_slab slab  ) 

Read user pointer from slab cache.

Parameters:
slab pointer to slab cache
Returns:
stored user pointer or 0

Definition at line 326 of file ddekit/src/memory.c.

struct ddekit_slab* ddekit_slab_init ( unsigned  size,
int  contiguous 
) [read]

Initialize slab cache.

Parameters:
size size of cache objects
contiguous make this slab use physically contiguous memory
Returns:
pointer to new slab cache or 0 on error

Definition at line 352 of file ddekit/src/memory.c.

void ddekit_slab_set_data ( struct ddekit_slab slab,
void *  data 
)

Store user pointer in slab cache.

Parameters:
slab pointer to slab cache
data user pointer

Definition at line 317 of file ddekit/src/memory.c.

void ddekit_slab_setup_page_cache ( unsigned  pages  ) 

Setup page cache for all slabs.

Parameters:
pages maximal number of memory pages
If the maximal number of unused pages is exceeded, subsequent deallocation will be freed at the memory server. This page cache caches pages from all slabs.

Definition at line 83 of file ddekit/src/memory.c.


Variable Documentation

struct ddekit_pcache* pcache_free [static]

Definition at line 62 of file ddekit/src/memory.c.

Definition at line 67 of file ddekit/src/memory.c.

l4_uint32_t pcache_num_entries = 1 [static]

Definition at line 71 of file ddekit/src/memory.c.

struct ddekit_pcache* pcache_used [static]

Definition at line 60 of file ddekit/src/memory.c.

Definition at line 65 of file ddekit/src/memory.c.


Generated on Wed Apr 11 06:39:15 2012 for DDE - The L4 Device Driver Environment by  doxygen 1.5.6