mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 15:01:44 +00:00
[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: Benjamin LaHaise <benjamin.c.lahaise@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
8476994af7
commit
01890a4c12
1 changed files with 2 additions and 1 deletions
|
@ -204,7 +204,7 @@ void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask)
|
||||||
{
|
{
|
||||||
void *element;
|
void *element;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
DEFINE_WAIT(wait);
|
wait_queue_t wait;
|
||||||
int gfp_temp;
|
int gfp_temp;
|
||||||
|
|
||||||
might_sleep_if(gfp_mask & __GFP_WAIT);
|
might_sleep_if(gfp_mask & __GFP_WAIT);
|
||||||
|
@ -235,6 +235,7 @@ repeat_alloc:
|
||||||
|
|
||||||
/* Now start performing page reclaim */
|
/* Now start performing page reclaim */
|
||||||
gfp_temp = gfp_mask;
|
gfp_temp = gfp_mask;
|
||||||
|
init_wait(&wait);
|
||||||
prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE);
|
prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE);
|
||||||
smp_mb();
|
smp_mb();
|
||||||
if (!pool->curr_nr)
|
if (!pool->curr_nr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue