memory.h File Reference

Go to the source code of this file.

Functions

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_alloc (struct ddekit_slab *slab)
 Allocate slab in slab cache.
void ddekit_slab_free (struct ddekit_slab *slab, void *objp)
 Deallocate slab in slab cache.
void ddekit_slab_setup_page_cache (unsigned pages)
 Setup page cache for all slabs.
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_malloc (int size)
 Allocate large memory block.
void ddekit_large_free (void *p)
 Free large memory block.
void * ddekit_contig_malloc (unsigned long size, unsigned long low, unsigned long high, unsigned long alignment, unsigned long boundary)
 FIXME contig_malloc() is the lowest-level allocator interface one could implement.
void * ddekit_simple_malloc (unsigned size)
 Allocate memory block via simple allocator.
void ddekit_simple_free (void *p)
 Free memory block via simple allocator.


Function Documentation

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

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

we should consider to provide vmalloc() too.

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 memory block.

Parameters:
p pointer to memory block
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 memory block.

Parameters:
size block size
Returns:
pointer to new memory block
Allocations via this allocator may be slow (because memory servers are involved) and should be used only for large (i.e., > page size) blocks. If allocations/deallocations are relatively dynamic this may not be what you want.

Allocated blocks have valid virt->phys mappings and are physically contiguous.

Allocate large memory block.

This is no useful for allocation < page size.

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

void ddekit_simple_free ( void *  p  ) 

Free memory block via simple allocator.

Parameters:
p pointer to memory block

Definition at line 87 of file malloc.c.

void* ddekit_simple_malloc ( unsigned  size  ) 

Allocate memory block via simple allocator.

Parameters:
size block size
Returns:
pointer to new memory block
The blocks allocated via this allocator CANNOT be used for DMA or other device operations, i.e., there exists no virt->phys mapping.

Parameters:
size block size
Returns:
pointer to new memory block
The blocks allocated via this allocator CANNOT be used for DMA or other device operations, i.e., there exists no virt->phys mapping.

Each chunk stores its size in the first word for free() to work.

Definition at line 46 of file malloc.c.

void* ddekit_slab_alloc ( struct ddekit_slab slab  ) 

Allocate slab in slab cache.

Parameters:
slab pointer to slab cache
Returns:
pointer to allocated slab

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 
)

Deallocate slab in slab cache.

Parameters:
slab pointer to slab cache
objp pointer to allocated slab

Definition at line 306 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 'pages' is too low, memory pages may be given back to the memory server (dm_phys) and just to be allocated again later. This hits performance (but saves memory). Increase 'pages' to avoid this thrashing-like effect.

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.

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.


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