kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* using prefetch
@ 2013-02-15 10:16 Kevin Wilson
  2013-02-15 16:15 ` Valdis.Kletnieks at vt.edu
  2013-02-15 16:42 ` michi1 at michaelblizek.twilightparadox.com
  0 siblings, 2 replies; 4+ messages in thread
From: Kevin Wilson @ 2013-02-15 10:16 UTC (permalink / raw)
  To: kernelnewbies

Hello, kernelnewbies
There are many cases in drivers where I see calls to prefetch|() of
some variable.
For example,
    prefetch(&skb->end); in 1 bnx2_tx_int(),
http://lxr.free-electrons.com/source/drivers/net/ethernet/broadcom/bnx2.c

AFAIK, what prefetch does is get a variable from memory and put it in
cache (L2 cache I believe).
Is the prefetch operation synchronous ? I mean, after calling it, are
we gauranteed that the variable is
indeed in the cache ?

So this is probably for improving performance, assuming that you will
need this variable in the near
future.
The comment there says:
/* prefetch skb_end_pointer() to speedup skb_shinfo(skb) */

According to this logic, anywhere that we want to call skb_shinfo(skb)
we better do a prefetch before.

In fact, if we prefetch any variable that we want to use then we end up
with performance boost.

So - any hints, what are the guidlines for using prefetch()?

rgs,
Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-15 20:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-15 10:16 using prefetch Kevin Wilson
2013-02-15 16:15 ` Valdis.Kletnieks at vt.edu
2013-02-15 16:42 ` michi1 at michaelblizek.twilightparadox.com
2013-02-15 20:18   ` Kevin Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).