#include "gm_call_trace.h"#include "gm_debug.h"#include "gm_internal.h"#include "gm_malloc_debug.h"#include "gm_struct_lock.h"Functions | |
| GM_ENTRY_POINT void * | gm_lookaside_alloc (struct gm_lookaside *l) |
| GM_ENTRY_POINT void * | gm_lookaside_zalloc (struct gm_lookaside *l) |
| GM_ENTRY_POINT void | gm_lookaside_free (void *ptr) |
| GM_ENTRY_POINT struct gm_lookaside * | gm_create_lookaside (gm_size_t entry_len, gm_size_t min_entry_cnt) |
| GM_ENTRY_POINT void | gm_destroy_lookaside (struct gm_lookaside *l) |
This file implements a lookaside list. It is mainly intended to allow efficient memory allocation of small structures in kernels where the minimum memory allocation is a page, but is not kernel-specific.
GM implements a lookaside list, which may be used to manage small fixed-length blocks more efficiently than gm_malloc() and gm_free(). Lookaside lists can also be used to ensure that at least a minimum number of blocks are available for allocation at all times.
|
|
gm_lookaside_alloc() allocates an entry from the lookaside table, with debugging. It returns a buffer of size ENTRY_LEN specified when the entry list L was created, or `0' if the buffer could not be allocated.
|
|
|
gm_lookaside_zalloc() allocates and clear an entry from the lookaside table.
|
|
|
gm_lookaside_free() schedules an allocated entry to be freed, and actually performs any scheduled free. It frees a block of memory previously allocated by a call to gm_lookaside_alloc(). The contents of the block of memory are guaranteed to be unchanged until the next operation is performed on the lookaside list.
|
|
||||||||||||
|
gm_create_lookaside() returns a newly created lookaside list to be used to allocate blocks of ENTRY_LEN bytes. MIN_ENTRY_CNT entries are preallocated.
|
|
|
gm_destroy_lookaside() frees a lookaside list and all associated resources, including any buffers currently allocated from the lookaside list.
|
1.4.4