diff options
author | Benjamin LaHaise <bcrl@kvack.org> | 2005-06-23 03:10:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:29 -0400 |
commit | 01890a4c120f68366441bf5e193d1b9dd543d4d0 (patch) | |
tree | ed854da46009b0837485e8acd17dc9d944e8068f /mm/mempool.c | |
parent | 8476994af7bd9352ecdf61ba760f7397f54e30a1 (diff) |
[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>
Diffstat (limited to 'mm/mempool.c')
-rw-r--r-- | mm/mempool.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/mempool.c b/mm/mempool.c index 920c8c3ab1b8..9a72f7d918fa 100644 --- a/mm/mempool.c +++ b/mm/mempool.c | |||
@@ -204,7 +204,7 @@ void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask) | |||
204 | { | 204 | { |
205 | void *element; | 205 | void *element; |
206 | unsigned long flags; | 206 | unsigned long flags; |
207 | DEFINE_WAIT(wait); | 207 | wait_queue_t wait; |
208 | int gfp_temp; | 208 | int gfp_temp; |
209 | 209 | ||
210 | might_sleep_if(gfp_mask & __GFP_WAIT); | 210 | might_sleep_if(gfp_mask & __GFP_WAIT); |
@@ -235,6 +235,7 @@ repeat_alloc: | |||
235 | 235 | ||
236 | /* Now start performing page reclaim */ | 236 | /* Now start performing page reclaim */ |
237 | gfp_temp = gfp_mask; | 237 | gfp_temp = gfp_mask; |
238 | init_wait(&wait); | ||
238 | prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE); | 239 | prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE); |
239 | smp_mb(); | 240 | smp_mb(); |
240 | if (!pool->curr_nr) | 241 | if (!pool->curr_nr) |