标签:free 传递 参数 不同 boot 示例 table 必须 tom
1 #include <linux/slab.h> 2 void *kmalloc(size_t size, int flags);
1 kmem_cache_t *kmem_cache_create(const char *name, size_t size, size_t offset, 2 unsigned long flags, void (*constructor)(void *, kmem_cache_t *, unsigned long flags), 3 void (*destructor)(void *, kmem_cache_t *, unsigned long flags));
1 void *kmem_cache_alloc(kmem_cache_t *cache, int flags); 2 void kmem_cache_free(kmem_cache_t *cache, const void *obj);
1 int kmem_cache_destroy(kmem_cache_t *cache);
1 mempool_t *mempool_create(int min_nr, 2 mempool_alloc_t *alloc_fn, 3 mempool_free_t *free_fn, 4 void *pool_data);
1 typedef void *(mempool_alloc_t)(int gfp_mask, void *pool_data); 2 typedef void (mempool_free_t)(void *element, void *pool_data);
1 int mempool_resize(mempool_t *pool, int new_min_nr, int gfp_mask); 2 void mempool_destory(mempool_t *pool);
1 get_zeroed_page(unsigned int flags); 2 __get_free_page(unsigned int flags); 3 __get_free_pages(unsigned int flags, unsigned int order); //页面的数量为2^order,最大值为10或11
1 void free_page(unsigned long addr); 2 void free_pages(unsinged long addr, unsigned long order);
1 struct page *alloc_pages_node(int nid, unsigned int flags, unsigned int order);
1 struct page *alloc_pages(unsigned int flags, unsigned int order); 2 struct page *alloc_page(unsigned int flags);
1 void __free_page(struct page *page); 2 void __free_pages(struct page *page, unsigned int order); 3 void free_hot_page(struct page *page); //影响cache的行为 4 void free_cold_page(struct page *page);
1 #include <linux/vmalloc.h> 2 void *vmalloc(unsigned long size); 3 void vfree(void * addr); 4 void *ioremap(unsigned long offset, unsigned long size); 5 void iounmap(void * addr);
1 DEFINE_PER_CPU(type, name); 2 DEFINE_PER_CPU(int[3], my_percpu_array);
1 get_cpu_var(sockets_in_use)++; 2 put_cpu_var(sockets_in_use);
1 per_cpu(variable, int cpu_id);
1 void *alloc_percpu(type); 2 void *__alloc_percpu(size_t size, size_t align);
1 per_cpu_ptr(void *per_cpu_var, int cpu_id);
1 int cpu; 2 cpu = get_cpu(); //防止cpu被抢占 3 ptr = per_cpu_ptr(per_cpu_var, cpu); 4 /* 操作每CPU变量*/ 5 put_cpu();
1 DECLARE_PER_CPU(type, name); 2 EXPORT_PER_CPU_SYMBOL(per_cpu_var); 3 EXPORT_PER_CPU_SYMBOL_GPL(per_cpu_var);
1 #include <linux/bootmem.h> 2 void *alloc_bootmem(unsigned long size); 3 void *alloc_bootmem_low(unsigned long size); 4 void *alloc_bootmem_pages(unsigned long size); 5 void *alloc_bootmem_low_pages(unsigned long size);
1 void free_bootmem(unsigned long addr, unsigned long size);
标签:free 传递 参数 不同 boot 示例 table 必须 tom
原文地址:https://www.cnblogs.com/adera/p/9962499.html