aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/genalloc.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 7d16ecabba96..75ae68ce03e1 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -14,11 +14,13 @@
14#include <linux/genalloc.h> 14#include <linux/genalloc.h>
15 15
16 16
17/* 17/**
18 * Create a new special memory pool. 18 * gen_pool_create - create a new special memory pool
19 *
20 * @min_alloc_order: log base 2 of number of bytes each bitmap bit represents 19 * @min_alloc_order: log base 2 of number of bytes each bitmap bit represents
21 * @nid: node id of the node the pool structure should be allocated on, or -1 20 * @nid: node id of the node the pool structure should be allocated on, or -1
21 *
22 * Create a new special memory pool that can be used to manage special purpose
23 * memory not managed by the regular kmalloc/kfree interface.
22 */ 24 */
23struct gen_pool *gen_pool_create(int min_alloc_order, int nid) 25struct gen_pool *gen_pool_create(int min_alloc_order, int nid)
24{ 26{
@@ -34,15 +36,15 @@ struct gen_pool *gen_pool_create(int min_alloc_order, int nid)
34} 36}
35EXPORT_SYMBOL(gen_pool_create); 37EXPORT_SYMBOL(gen_pool_create);
36 38
37 39/**
38/* 40 * gen_pool_add - add a new chunk of special memory to the pool
39 * Add a new chunk of memory to the specified pool.
40 *
41 * @pool: pool to add new memory chunk to 41 * @pool: pool to add new memory chunk to
42 * @addr: starting address of memory chunk to add to pool 42 * @addr: starting address of memory chunk to add to pool
43 * @size: size in bytes of the memory chunk to add to pool 43 * @size: size in bytes of the memory chunk to add to pool
44 * @nid: node id of the node the chunk structure and bitmap should be 44 * @nid: node id of the node the chunk structure and bitmap should be
45 * allocated on, or -1 45 * allocated on, or -1
46 *
47 * Add a new chunk of special memory to the specified pool.
46 */ 48 */
47int gen_pool_add(struct gen_pool *pool, unsigned long addr, size_t size, 49int gen_pool_add(struct gen_pool *pool, unsigned long addr, size_t size,
48 int nid) 50 int nid)
@@ -69,11 +71,12 @@ int gen_pool_add(struct gen_pool *pool, unsigned long addr, size_t size,
69} 71}
70EXPORT_SYMBOL(gen_pool_add); 72EXPORT_SYMBOL(gen_pool_add);
71 73
72 74/**
73/* 75 * gen_pool_destroy - destroy a special memory pool
74 * Destroy a memory pool. Verifies that there are no outstanding allocations.
75 *
76 * @pool: pool to destroy 76 * @pool: pool to destroy
77 *
78 * Destroy the specified special memory pool. Verifies that there are no
79 * outstanding allocations.
77 */ 80 */
78void gen_pool_destroy(struct gen_pool *pool) 81void gen_pool_destroy(struct gen_pool *pool)
79{ 82{
@@ -99,13 +102,13 @@ void gen_pool_destroy(struct gen_pool *pool)
99} 102}
100EXPORT_SYMBOL(gen_pool_destroy); 103EXPORT_SYMBOL(gen_pool_destroy);
101 104
102 105/**
103/* 106 * gen_pool_alloc - allocate special memory from the pool
104 * Allocate the requested number of bytes from the specified pool.
105 * Uses a first-fit algorithm.
106 *
107 * @pool: pool to allocate from 107 * @pool: pool to allocate from
108 * @size: number of bytes to allocate from the pool 108 * @size: number of bytes to allocate from the pool
109 *
110 * Allocate the requested number of bytes from the specified pool.
111 * Uses a first-fit algorithm.
109 */ 112 */
110unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size) 113unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
111{ 114{
@@ -157,13 +160,13 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
157} 160}
158EXPORT_SYMBOL(gen_pool_alloc); 161EXPORT_SYMBOL(gen_pool_alloc);
159 162
160 163/**
161/* 164 * gen_pool_free - free allocated special memory back to the pool
162 * Free the specified memory back to the specified pool.
163 *
164 * @pool: pool to free to 165 * @pool: pool to free to
165 * @addr: starting address of memory to free back to pool 166 * @addr: starting address of memory to free back to pool
166 * @size: size in bytes of memory to free 167 * @size: size in bytes of memory to free
168 *
169 * Free previously allocated special memory back to the specified pool.
167 */ 170 */
168void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size) 171void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size)
169{ 172{