using prefetch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux