Skip to content

Commit

Permalink
pktgen: adding prefetchw() call
Browse files Browse the repository at this point in the history
We know for sure pktgen is going to write skb->data right after
*_alloc_skb, causing unnecessary cache misses.

Idea is to add a prefetchw() call to prefetch the first cache line
indicated by skb->data. On systems with Adjacent Cache Line Prefetch,
it's probably two cache lines are prefetched.

With this patch, pktgen on Intel SR1625 server with two E5530
quad-core processors and a single ixgbe-based NIC went from 8.63Mpps
to 9.03Mpps, with 4.6% improvement.

Signed-off-by: Junchang Wang <junchangwang@gmail.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Junchang Wang authored and David S. Miller committed Dec 10, 2010
1 parent 4afb752 commit a8d764b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2660,6 +2660,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
sprintf(pkt_dev->result, "No memory");
return NULL;
}
prefetchw(skb->data);

skb_reserve(skb, datalen);

Expand Down Expand Up @@ -3007,6 +3008,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
sprintf(pkt_dev->result, "No memory");
return NULL;
}
prefetchw(skb->data);

skb_reserve(skb, 16);

Expand Down

0 comments on commit a8d764b

Please sign in to comment.