diff mbox

[net-next-2.6] pktgen: adding prefetchw() call

Message ID 20101206063349.GA6147@Desktop-Junchang
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Junchang Wang Dec. 6, 2010, 6:33 a.m. UTC
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.


Signed-off-by: Junchang Wang <junchangwang@gmail.com>
---
 net/core/pktgen.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

--Junchang 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Dumazet Dec. 6, 2010, 7:26 a.m. UTC | #1
Le lundi 06 décembre 2010 à 14:33 +0800, Junchang Wang a écrit :
> 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.
> 
> 
> Signed-off-by: Junchang Wang <junchangwang@gmail.com>
> ---

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 8, 2010, 6:17 p.m. UTC | #2
From: Junchang Wang <junchangwang@gmail.com>
Date: Mon, 6 Dec 2010 14:33:52 +0800

> 
> 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.
> 
> 
> Signed-off-by: Junchang Wang <junchangwang@gmail.com>

Your patch was corrupted by your email client, please fix this up
and resubmit.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 2953b2a..18fe20d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -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);
--