Skip to content

Commit

Permalink
[PATCH] rcu: add a prefetch() in rcu_do_batch()
Browse files Browse the repository at this point in the history
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 patch 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 <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Eric Dumazet authored and Linus Torvalds committed Dec 7, 2006
1 parent 9a0efbb commit 1c69d92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/rcupdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ static void rcu_do_batch(struct rcu_data *rdp)

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

0 comments on commit 1c69d92

Please sign in to comment.