public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Andrew Morton <akpm@osdl.org>,
	Dipankar Sarma <dipankar@in.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RCU] adds a prefetch() in rcu_do_batch()
Date: Wed, 29 Nov 2006 17:25:28 -0800	[thread overview]
Message-ID: <20061130012528.GJ2335@us.ibm.com> (raw)
In-Reply-To: <200611221602.29597.dada1@cosmosbay.com>

On Wed, Nov 22, 2006 at 04:02:29PM +0100, Eric Dumazet wrote:
> On some workloads, (for example when lot of close() syscalls are done), RCU
> qlen can be quite large, and RCU heads are no longer in cpu cache when
> rcu_do_batch() is called.
> 
> This patches adds a prefetch() in rcu_do_batch() to give CPU a hint to bring
> back cache lines containing 'struct rcu_head's.
> 
> Most list manipulations macros include prefetch(), but not open coded ones (at
> least with current C compilers :) )
> 
> I got a nice speedup on a trivial benchmark  (3.48 us per iteration instead of
> 3.95 us on a 1.6 GHz Pentium-M)
> while (1) { pipe(p); close(fd[0]); close(fd[1]);}

Interesting!  How much of the speedup was due to the prefetch() and how
much to removing the extra store to rdp->donelist?

							Thanx, Paul

> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

> --- linux-2.6.19-rc6/kernel/rcupdate.c	2006-11-16 05:03:40.000000000 +0100
> +++ linux-2.6.19-rc6-ed/kernel/rcupdate.c	2006-11-22 15:12:09.000000000 +0100
> @@ -235,12 +235,14 @@ static void rcu_do_batch(struct rcu_data
> 
>  	list = rdp->donelist;
>  	while (list) {
> -		next = rdp->donelist = list->next;
> +		next = list->next;
> +		prefetch(next);
>  		list->func(list);
>  		list = next;
>  		if (++count >= rdp->blimit)
>  			break;
>  	}
> +	rdp->donelist = list;
> 
>  	local_irq_disable();
>  	rdp->qlen -= count;


  parent reply	other threads:[~2006-11-30  1:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-21 20:33 [PATCH] snd-hda-intel: fix insufficient memory wbrana
2006-11-22  6:46 ` Andrew Morton
2006-11-22 15:02   ` [RCU] adds a prefetch() in rcu_do_batch() Eric Dumazet
2006-11-22 17:48     ` [PATCH] dont insert pipe dentries into dentry_hashtable Eric Dumazet
2006-11-22 21:36       ` Andrew Morton
2006-11-22 21:40         ` Al Viro
2006-11-23  4:12         ` David Miller
2006-11-30  1:25     ` Paul E. McKenney [this message]
2006-11-30  8:55       ` [RCU] adds a prefetch() in rcu_do_batch() Eric Dumazet
2006-11-30 17:15         ` Paul E. McKenney
2006-11-22 17:19   ` [PATCH] snd-hda-intel: fix insufficient memory wbrana
2006-11-22 20:04     ` Andrew Morton
2006-11-23 20:17       ` wbrana
2006-11-23 21:10         ` Andrew Morton

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=20061130012528.GJ2335@us.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dada1@cosmosbay.com \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.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