* [PATCH net-next-2.6] pktgen: adding prefetchw() call
@ 2010-12-06 6:33 Junchang Wang
2010-12-06 7:26 ` Eric Dumazet
2010-12-08 18:17 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Junchang Wang @ 2010-12-06 6:33 UTC (permalink / raw)
To: davem, eric.dumazet, robert.olsson, john.r.fastabend, andy.shevchenko
Cc: netdev
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(-)
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);
--
--Junchang
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next-2.6] pktgen: adding prefetchw() call
2010-12-06 6:33 [PATCH net-next-2.6] pktgen: adding prefetchw() call Junchang Wang
@ 2010-12-06 7:26 ` Eric Dumazet
2010-12-08 18:17 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2010-12-06 7:26 UTC (permalink / raw)
To: Junchang Wang
Cc: davem, robert.olsson, john.r.fastabend, andy.shevchenko, netdev
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next-2.6] pktgen: adding prefetchw() call
2010-12-06 6:33 [PATCH net-next-2.6] pktgen: adding prefetchw() call Junchang Wang
2010-12-06 7:26 ` Eric Dumazet
@ 2010-12-08 18:17 ` David Miller
2010-12-09 2:55 ` Junchang Wang
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2010-12-08 18:17 UTC (permalink / raw)
To: junchangwang
Cc: eric.dumazet, robert.olsson, john.r.fastabend, andy.shevchenko, netdev
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next-2.6] pktgen: adding prefetchw() call
2010-12-08 18:17 ` David Miller
@ 2010-12-09 2:55 ` Junchang Wang
2010-12-10 23:37 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Junchang Wang @ 2010-12-09 2:55 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, robert.olsson, john.r.fastabend, andy.shevchenko,
netdev, wangjc
On Wed, Dec 08, 2010 at 10:17:43AM -0800, David Miller wrote:
>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.
Signed-off-by: Junchang Wang <junchangwang@gmail.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/core/pktgen.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
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);
--
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next-2.6] pktgen: adding prefetchw() call
2010-12-09 2:55 ` Junchang Wang
@ 2010-12-10 23:37 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-12-10 23:37 UTC (permalink / raw)
To: junchangwang
Cc: eric.dumazet, robert.olsson, john.r.fastabend, andy.shevchenko,
netdev, wangjc
From: Junchang Wang <junchangwang@gmail.com>
Date: Thu, 9 Dec 2010 10:55:16 +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 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-12-10 23:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-06 6:33 [PATCH net-next-2.6] pktgen: adding prefetchw() call Junchang Wang
2010-12-06 7:26 ` Eric Dumazet
2010-12-08 18:17 ` David Miller
2010-12-09 2:55 ` Junchang Wang
2010-12-10 23:37 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.