2 * Basic general purpose allocator for managing special purpose memory
3 * not managed by the regular kmalloc/kfree interface.
4 * Uses for this includes on-device special memory, uncached memory
7 * This source code is licensed under the GNU General Public License,
8 * Version 2. See the file COPYING for more details.
13 struct gen_pool *__must_check gen_pool_create(unsigned order, int nid);
15 int __must_check gen_pool_add(struct gen_pool *pool, unsigned long addr,
16 size_t size, int nid);
18 void gen_pool_destroy(struct gen_pool *pool);
20 unsigned long __must_check
21 gen_pool_alloc_aligned(struct gen_pool *pool, size_t size,
22 unsigned alignment_order);
25 * gen_pool_alloc() - allocate special memory from the pool
26 * @pool: Pool to allocate from.
27 * @size: Number of bytes to allocate from the pool.
29 * Allocate the requested number of bytes from the specified pool.
30 * Uses a first-fit algorithm.
32 static inline unsigned long __must_check
33 gen_pool_alloc(struct gen_pool *pool, size_t size)
35 return gen_pool_alloc_aligned(pool, size, 0);
38 void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size);