linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Benjamin LaHaise <bcrl@kvack.org>
Cc: linux-mm@kvack.org
Subject: Re: mempool - only init waitqueue in slow path
Date: Fri, 13 May 2005 23:26:21 -0700	[thread overview]
Message-ID: <20050513232621.75f8a4e7.akpm@osdl.org> (raw)
In-Reply-To: <20050513155054.GB4750@kvack.org>

Benjamin LaHaise <bcrl@kvack.org> wrote:
>
> Here's a small patch to improve the performance of mempool_alloc by only 
>  initializing the wait queue when we're about to wait.
> 
>  		-ben
>  -- 
>  "Time is what keeps everything from happening all at once." -- John Wheeler
> 
>  Signed-off-by: Benjamin LaHaise <benjamin.c.lahaise@intel.com>
>  diff -purN v2.6.12-rc4/mm/mempool.c mempool-rc4/mm/mempool.c
>  --- v2.6.12-rc4/mm/mempool.c	2005-05-09 15:47:01.000000000 -0400
>  +++ mempool-rc4/mm/mempool.c	2005-05-13 10:04:54.000000000 -0400
>  @@ -197,7 +197,7 @@ void * mempool_alloc(mempool_t *pool, un
>   {
>   	void *element;
>   	unsigned long flags;
>  -	DEFINE_WAIT(wait);
>  +	wait_queue_t wait;
>   	int gfp_temp;
>   
>   	might_sleep_if(gfp_mask & __GFP_WAIT);
>  @@ -228,6 +228,7 @@ repeat_alloc:
>   
>   	/* Now start performing page reclaim */
>   	gfp_temp = gfp_mask;
>  +	init_wait(&wait);
>   	prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE);
>   	smp_mb();

hmm, I'd have thought that gcc was smart enough to defer the
initialisations until the thing-which-is-being-initialised is about to be
used.  But with gcc-3.4 this patch changes the generated asm in large ways.

Odd.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

      reply	other threads:[~2005-05-14  6:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13 15:50 Benjamin LaHaise
2005-05-14  6:26 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050513232621.75f8a4e7.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=bcrl@kvack.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox