pktgen: adding prefetchw() call
Subsystems (2)
PATCH 1/1 pktgen: adding prefetchw() call
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 prefetch, 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.
--- net/core/pktgen.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/core/pktgen.c +2 -1
@@ -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);
@@ -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 ); --
--Junchang
Quoted 11 lines · Junchang Wang
We know for sure pktgen is going to write
skb->dataright after*_alloc_skb, causing unnecessary cache misses.Idea is to add a
prefetchw()call to prefetch the first cache line indicated byskb->data. On systems with Adjacent Cache Line Prefetch, it's probably two cache lines are prefetched.
With this prefetch, 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.
Quoted 2 lines
Signed-off-by Junchang Wang <[email protected]>---
David Miller
maintainerFrom: Junchang Wang <[email protected]>
Date: Mon, 6 Dec 2010 14:33:52 +0800
Quoted 8 lines
We know for sure pktgen is going to write
skb->dataright after*_alloc_skb, causing unnecessary cache misses.Idea is to add a
prefetchw()call to prefetch the first cache line indicated byskb->data. On systems with Adjacent Cache Line Prefetch, it's probably two cache lines are prefetched.
Quoted 6 lines
With this prefetch, 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 <[email protected]>
Your patch was corrupted by your email client, please fix this up and resubmit.
PATCH 1/1 pktgen: adding prefetchw() call
Quoted 2 lines · David Miller
Your patch was corrupted by your email client, please fix this up and resubmit.
Sorry. I'll avoid this next time. Here's a new version, and I had tested it. Thanks David and Eric.
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.
--- net/core/pktgen.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/core/pktgen.c +2 -0
@@ -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);
@@ -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 );
--
From: Junchang Wang <[email protected]>
Date: Thu, 9 Dec 2010 10:55:16 +0800
Quoted 7 lines
We know for sure pktgen is going to write
skb->dataright after*_alloc_skb, causing unnecessary cache misses.Idea is to add a
prefetchw()call to prefetch the first cache line indicated byskb->data. On systems with Adjacent Cache Line Prefetch, it's probably two cache lines are prefetched.
Quoted 6 lines
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 <[email protected]>Acked-by Eric Dumazet <[email protected]>
Applied, thanks.