#include <linux/gfp.h>
#include <linux/types.h>
#include <linux/slab_def.h>
Go to the source code of this file.
|
void __init | kmem_cache_init (void) |
|
int | slab_is_available (void) |
|
struct kmem_cache * | kmem_cache_create (const char *, size_t, size_t, unsigned long, void(*)(void *)) |
|
void | kmem_cache_destroy (struct kmem_cache *) |
|
int | kmem_cache_shrink (struct kmem_cache *) |
|
void | kmem_cache_free (struct kmem_cache *, void *) |
|
unsigned int | kmem_cache_size (struct kmem_cache *) |
|
void *__must_check | __krealloc (const void *, size_t, gfp_t) |
|
void *__must_check | krealloc (const void *, size_t, gfp_t) |
|
void | kfree (const void *) |
|
void | kzfree (const void *) |
|
size_t | ksize (const void *) |
|
void * | kmem_cache_alloc (struct kmem_cache *, gfp_t) |
|
void __init | kmem_cache_init_late (void) |
|
#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) |
#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long) |
#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_HIGH) |
#define KMALLOC_SHIFT_HIGH |
Value:
Definition at line 154 of file slab.h.
#define KMEM_CACHE |
( |
|
__struct, |
|
|
|
__flags |
|
) |
| |
Value:
sizeof(struct __struct), __alignof__(struct __struct),\
Definition at line 141 of file slab.h.
#define SLAB_CACHE_DMA 0x00004000UL /* Use GFP_DMA memory */ |
#define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */ |
#define SLAB_DEBUG_OBJECTS 0x00000000UL |
#define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ |
#define SLAB_FAILSLAB 0x00000000UL |
#define SLAB_HWCACHE_ALIGN 0x00002000UL /* Align objs on cache lines */ |
#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ |
#define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */ |
#define SLAB_NOTRACK 0x00000000UL |
#define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */ |
#define SLAB_POISON 0x00000800UL /* DEBUG: Poison objects */ |
#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ |
#define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */ |
#define SLAB_STORE_USER 0x00010000UL /* DEBUG: Store the last owner for bug hunting */ |
#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ |
#define ZERO_OR_NULL_PTR |
( |
|
x | ) |
|
Value:
Definition at line 92 of file slab.h.
#define ZERO_SIZE_PTR ((void *)16) |
__krealloc - like krealloc() but don't free
.
: object to reallocate memory for. : how many bytes of memory are required. : the type of memory to allocate.
This function is like krealloc() except it never frees the originally allocated buffer. Use this if you don't want to free the buffer immediately like, for example, with RCU.
Definition at line 137 of file util.c.
kfree - free previously allocated memory : pointer returned by kmalloc.
If is NULL, no operation is performed.
Don't free memory not originally allocated by kmalloc() or you will run into trouble.
Definition at line 3952 of file slab.c.
kmem_cache_alloc - Allocate an object : The cache to allocate from. : See kmalloc().
Allocate an object from this cache. The flags are only relevant if the cache has no available objects.
Definition at line 3780 of file slab.c.
kmem_cache_free - Deallocate an object : The cache the allocation was from. : The previously allocated object.
Free an object which was previously allocated from this cache.
Definition at line 3928 of file slab.c.
kmem_cache_shrink - Shrink a cache. : The cache to shrink.
Releases as many slabs as possible for a cache. To help debugging, a zero exit status indicates all slabs were released.
Definition at line 2716 of file slab.c.
krealloc - reallocate memory. The contents will remain unchanged.
: object to reallocate memory for. : how many bytes of memory are required. : the type of memory to allocate.
The contents of the object pointed to are preserved up to the lesser of the new and old sizes. If is
NULL, krealloc() behaves exactly like kmalloc(). If is 0 and is
not a NULL pointer, the object pointed to is freed.
Definition at line 158 of file util.c.
ksize - get the actual amount of memory allocated for a given object : Pointer to the object
kmalloc may internally round up allocations and return more memory than requested. ksize() can be used to determine the actual amount of memory allocated. The caller may use this additional memory, even though a smaller amount of memory was initially specified with the kmalloc call. The caller must guarantee that objp points to a valid object previously allocated with either kmalloc() or kmem_cache_alloc(). The object must not be freed during the duration of the call.
Definition at line 4689 of file slab.c.
kzfree - like kfree but zero memory
: object to free memory of
The memory of the object points
to is zeroed before freed. If is
NULL, kzfree() does nothing.
Note: this function zeroes the whole allocated buffer which can be a good deal bigger than the requested buffer size passed to kmalloc(). So be careful when using this function in performance sensitive code.
Definition at line 186 of file util.c.