public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Dipankar Sarma <dipankar@in.ibm.com>, linux-kernel@vger.kernel.org
Subject: [RCU] adds a prefetch() in rcu_do_batch()
Date: Wed, 22 Nov 2006 16:02:29 +0100	[thread overview]
Message-ID: <200611221602.29597.dada1@cosmosbay.com> (raw)
In-Reply-To: <20061121224613.548207f9.akpm@osdl.org>

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

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]);}

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

[-- Attachment #2: rcu.prefetch.patch --]
[-- Type: text/plain, Size: 492 bytes --]

--- 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;

  reply	other threads:[~2006-11-22 15:02 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   ` Eric Dumazet [this message]
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     ` [RCU] adds a prefetch() in rcu_do_batch() Paul E. McKenney
2006-11-30  8:55       ` 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=200611221602.29597.dada1@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=akpm@osdl.org \
    --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