Commit 01890a4c authored by Benjamin LaHaise's avatar Benjamin LaHaise Committed by Linus Torvalds
Browse files

[PATCH] mempool - only init waitqueue in slow path

Here's a small patch to improve the performance of mempool_alloc by only
initializing the wait queue when we're about to wait.
Signed-off-by: default avatarBenjamin LaHaise <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 8476994a
......@@ -204,7 +204,7 @@ void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask)
void *element;
unsigned long flags;
wait_queue_t wait;
int gfp_temp;
might_sleep_if(gfp_mask & __GFP_WAIT);
......@@ -235,6 +235,7 @@ repeat_alloc:
/* Now start performing page reclaim */
gfp_temp = gfp_mask;
prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE);
if (!pool->curr_nr)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment