Subject: Re: [PATCH net-next] net: netdev_alloc_skb() use build_skb()

From: "Michael S. Tsirkin" <[email-masked]>
Date: Mon, 4 Jun 2012 21:16:37 +0300

On Mon, Jun 04, 2012 at 07:44:50PM +0200, Eric Dumazet wrote:
> On Mon, 2012-06-04 at 20:20 +0300, Michael S. Tsirkin wrote:
> 
> > I see. virtio allocates full 4K pages which works well for GSO
> > but it means smaller packets would get large truesize
> > wasting lots of memory.
> > So maybe we should keep copying packets < 128 bytes.
> 
> Yet, but restrict the copy to bare minimum if > 128 bytes
> 
> See following commit for details (actual changelog bigger than patch
> itself)
> 
> commit 56138f50d1900b0c3d8647376e37b488b23ba53d
> Author: Eric Dumazet <[email-masked]>
> Date:   Fri May 18 04:48:33 2012 +0000
> 
>     iwlwifi: dont pull too much payload in skb head
>     
>     As iwlwifi use fat skbs, it should not pull too much data in skb->head,
>     and particularly no tcp data payload, or splice() is slower, and TCP
>     coalescing is disabled. Copying payload to userland also involves at
>     least two copies (part from header, part from fragment)
>     
>     Each layer will pull its header from the fragment as needed.
>     
>     (on 64bit arches, skb_tailroom(skb) at this point is 192 bytes)
>     
>     With this patch applied, I have a major reduction of collapsed/pruned
>     TCP packets, a nice increase of TCPRcvCoalesce counter, and overall
>     better Internet User experience.
>     
>     Small packets are still using a fragless skb, so that page can be reused
>     by the driver.
>     

Will take a look, thanks.
By the way, this comment at build_skb:
* @frag_size: size of fragment, or 0 if head was kmalloced

is not very clear to me. Could you clarify what exactly size
of fragment means in this context?