netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pre-fetching skb for delayed send
@ 2012-07-06 23:10 Ben Greear
  2012-07-06 23:52 ` Benjamin LaHaise
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Greear @ 2012-07-06 23:10 UTC (permalink / raw)
  To: netdev

Suppose one has a bridge-like thing that may store up packets
for a bit (100+ms) before sending them....

We notice that performance is very good if we can run with (near) zero
delay, but at higher delay, performance goes down significantly when attempting 10G
speeds.  I assume this is because we are sending skbs that are no longer in the cache...

So, is there an easy way to pre-fetch an skb and it's related pages?

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pre-fetching skb for delayed send
  2012-07-06 23:10 pre-fetching skb for delayed send Ben Greear
@ 2012-07-06 23:52 ` Benjamin LaHaise
  2012-07-07  4:15   ` Ben Greear
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin LaHaise @ 2012-07-06 23:52 UTC (permalink / raw)
  To: Ben Greear; +Cc: netdev

On Fri, Jul 06, 2012 at 04:10:40PM -0700, Ben Greear wrote:
> So, is there an easy way to pre-fetch an skb and it's related pages?

One trick would be to store the pointers to the skbs in an array rather than 
relying on a list of skbs.  That would enable you to issue prefetches for 
multiple skbs from a single cache line of the array, rather than relying 
upon the slow chasing of pointers guaranteed to cache miss in a list.

		-ben
-- 
"Thought is the essence of where you are now."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pre-fetching skb for delayed send
  2012-07-06 23:52 ` Benjamin LaHaise
@ 2012-07-07  4:15   ` Ben Greear
  2012-07-07 14:18     ` Benjamin LaHaise
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Greear @ 2012-07-07  4:15 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: netdev

On 07/06/2012 04:52 PM, Benjamin LaHaise wrote:
> On Fri, Jul 06, 2012 at 04:10:40PM -0700, Ben Greear wrote:
>> So, is there an easy way to pre-fetch an skb and it's related pages?
>
> One trick would be to store the pointers to the skbs in an array rather than
> relying on a list of skbs.  That would enable you to issue prefetches for
> multiple skbs from a single cache line of the array, rather than relying
> upon the slow chasing of pointers guaranteed to cache miss in a list.

Well, to start with..I at least know the next skb to transmit,
so I figured I'd prefetch it before starting tx of the current
skb.

My question is more basic though:  Given an skb, how do you prefetch
it...do you just prefetch the skb pointer, or do you need to dig into
the guts of the skb?

Thanks,
Ben

>
> 		-ben
>


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pre-fetching skb for delayed send
  2012-07-07  4:15   ` Ben Greear
@ 2012-07-07 14:18     ` Benjamin LaHaise
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin LaHaise @ 2012-07-07 14:18 UTC (permalink / raw)
  To: Ben Greear; +Cc: netdev

On Fri, Jul 06, 2012 at 09:15:29PM -0700, Ben Greear wrote:
> Well, to start with..I at least know the next skb to transmit,
> so I figured I'd prefetch it before starting tx of the current
> skb.

Prefetching data you're just about to immediately access doesn't actually 
help improve performance -- it's better to just access the data.  Prefetching 
subsequent skbs should be of more benefit.

> My question is more basic though:  Given an skb, how do you prefetch
> it...do you just prefetch the skb pointer, or do you need to dig into
> the guts of the skb?

See prefetch.h for details.  Just pass the pointer to the cacheline you want 
to trigger prefetch on to prefetch() or prefetchw(), or use prefetch_range() 
(probably useful for skbs given that they're larger than one cacheline).  
For an skb, you may have to prefetch the frag list as well.

		-ben
-- 
"Thought is the essence of where you are now."

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-07 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06 23:10 pre-fetching skb for delayed send Ben Greear
2012-07-06 23:52 ` Benjamin LaHaise
2012-07-07  4:15   ` Ben Greear
2012-07-07 14:18     ` Benjamin LaHaise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).