June 2001
Intermediate to advanced
592 pages
19h 20m
English
The functions and symbols related to memory allocation follow.
#include <linux/malloc.h> , void *kmalloc(size_t size, int flags); , void kfree(void *obj); The most frequently used interface to memory allocation.
#include <linux/mm.h> , GFP_KERNEL , GFP_ATOMIC , __GFP_DMA , __GFP_HIGHMEM kmalloc flags. __GFP_DMA and __GFP_HIGHMEM are flags that can be OR’d to either GFP_KERNEL or GFP_ATOMIC.
#include <linux/malloc.h> , kmem_cache_t *kmem_cache_create(char *name, size_t size, size_t offset, unsigned long flags, constructor(), destructor()); , int kmem_cache_destroy(kmem_cache_t *cache); Create and destroy a slab cache. The cache can be used to allocate several objects of the same size.
SLAB_NO_REAP , SLAB_HWCACHE_ALIGN , SLAB_CACHE_DMA Flags that can be specified while creating a cache.
SLAB_CTOR_ATOMIC , SLAB_CTOR_CONSTRUCTOR Flags that the allocator can pass to the constructor and the destructor functions.
void *kmem_cache_alloc(kmem_cache_t *cache, int flags); , void kmem_cache_free(kmem_cache_t *cache, const void *obj); Allocate and release a single object from the cache.
unsigned long get_zeroed_page(int flags); , unsigned long __get_free_page(int flags); , unsigned long __get_free_pages(int flags, unsigned long order); , unsigned long __get_dma_pages(int flags, unsigned long order); The page-oriented allocation functions. get_zeroed_page returns a single, zero-filled page. All the other versions of the call ...