mempool_t *pool;  pool = kmalloc(sizeof(*pool), GFP_KERNEL); if (!pool) return NULL; memset(pool, 0, sizeof(*pool)); pool->elements = kmalloc(min_nr * sizeof(void *), GFP_KERNEL); if (!pool->elements) { kfree(pool); return NULL; } spin_lock_init(&pool->lock); pool->min_nr = min_nr; pool->pool_data = pool_data; init_waitqueue_head(&pool->wait); pool->alloc = alloc_fn; pool->free = free_fn;  /* * First pre-allocate the guaranteed number of buffers. */ while (pool->curr_nr < pool->min_nr) { void *element;  element = pool->alloc(GFP_KERNEL, pool->pool_data); if (unlikely(!element)) { free_pool(pool); return NULL; } add_element(pool, element); } return pool; 
return  mempool_create_node(min_nr,alloc_fn,free_fn, pool_data,-1); 
mempool_t * mempool_create(int min_nr, mempool_alloc_t *alloc_fn,				mempool_free_t *free_fn, void *pool_data){	mempool_t *pool;	pool = kmalloc(sizeof(*pool), GFP_KERNEL);	if (!pool)		return NULL;	memset(pool, 0, sizeof(*pool));	pool->elements = kmalloc(min_nr * sizeof(void *), GFP_KERNEL);	if (!pool->elements) {		kfree(pool);		return NULL;	}	spin_lock_init(&pool->lock);	pool->min_nr = min_nr;	pool->pool_data = pool_data;	init_waitqueue_head(&pool->wait);	pool->alloc = alloc_fn;	pool->free = free_fn;	/*	 * First pre-allocate the guaranteed number of buffers.	 */	while (pool->curr_nr < pool->min_nr) {		void *element;		element = pool->alloc(GFP_KERNEL, pool->pool_data);		if (unlikely(!element)) {			free_pool(pool);			return NULL;		}		add_element(pool, element);	}	return pool;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1946089a109251655c5438d92c539bd2930e71ea/mempool.c/clean/mm/mempool.c