Lines Matching refs:pool

202 	struct zbud_pool *pool;  in zbud_create_pool()  local
205 pool = kzalloc(sizeof(struct zbud_pool), gfp); in zbud_create_pool()
206 if (!pool) in zbud_create_pool()
208 spin_lock_init(&pool->lock); in zbud_create_pool()
210 INIT_LIST_HEAD(&pool->unbuddied[i]); in zbud_create_pool()
211 INIT_LIST_HEAD(&pool->buddied); in zbud_create_pool()
212 pool->pages_nr = 0; in zbud_create_pool()
213 return pool; in zbud_create_pool()
222 static void zbud_destroy_pool(struct zbud_pool *pool) in zbud_destroy_pool() argument
224 kfree(pool); in zbud_destroy_pool()
246 static int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp, in zbud_alloc() argument
259 spin_lock(&pool->lock); in zbud_alloc()
263 if (!list_empty(&pool->unbuddied[i])) { in zbud_alloc()
264 zhdr = list_first_entry(&pool->unbuddied[i], in zbud_alloc()
276 spin_unlock(&pool->lock); in zbud_alloc()
280 spin_lock(&pool->lock); in zbud_alloc()
281 pool->pages_nr++; in zbud_alloc()
294 list_add(&zhdr->buddy, &pool->unbuddied[freechunks]); in zbud_alloc()
297 list_add(&zhdr->buddy, &pool->buddied); in zbud_alloc()
301 spin_unlock(&pool->lock); in zbud_alloc()
311 static void zbud_free(struct zbud_pool *pool, unsigned long handle) in zbud_free() argument
316 spin_lock(&pool->lock); in zbud_free()
331 pool->pages_nr--; in zbud_free()
335 list_add(&zhdr->buddy, &pool->unbuddied[freechunks]); in zbud_free()
338 spin_unlock(&pool->lock); in zbud_free()
353 static void *zbud_map(struct zbud_pool *pool, unsigned long handle) in zbud_map() argument
363 static void zbud_unmap(struct zbud_pool *pool, unsigned long handle) in zbud_unmap() argument
374 static u64 zbud_get_pool_size(struct zbud_pool *pool) in zbud_get_pool_size() argument
376 return pool->pages_nr; in zbud_get_pool_size()
388 static void zbud_zpool_destroy(void *pool) in zbud_zpool_destroy() argument
390 zbud_destroy_pool(pool); in zbud_zpool_destroy()
393 static int zbud_zpool_malloc(void *pool, size_t size, gfp_t gfp, in zbud_zpool_malloc() argument
396 return zbud_alloc(pool, size, gfp, handle); in zbud_zpool_malloc()
398 static void zbud_zpool_free(void *pool, unsigned long handle) in zbud_zpool_free() argument
400 zbud_free(pool, handle); in zbud_zpool_free()
403 static void *zbud_zpool_map(void *pool, unsigned long handle, in zbud_zpool_map() argument
406 return zbud_map(pool, handle); in zbud_zpool_map()
408 static void zbud_zpool_unmap(void *pool, unsigned long handle) in zbud_zpool_unmap() argument
410 zbud_unmap(pool, handle); in zbud_zpool_unmap()
413 static u64 zbud_zpool_total_size(void *pool) in zbud_zpool_total_size() argument
415 return zbud_get_pool_size(pool) * PAGE_SIZE; in zbud_zpool_total_size()