WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: RX_COPY_THRESHOLD in netfront

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] Re: RX_COPY_THRESHOLD in netfront
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 12 Aug 2006 10:29:19 +1000
Cc: Xen Development Mailing List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 11 Aug 2006 17:30:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C1026D88.C8B%Keir.Fraser@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20060804144409.GA13529@xxxxxxxxxxxxxxxxxxx> <C1026D88.C8B%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
Hi Keir:

On Fri, Aug 11, 2006 at 05:23:20PM +0100, Keir Fraser wrote:
> 
> Does the RX_COPY_THRESHOLD you added to netfront need to be as large as 256?
> It seems rather large: for example, the copy length in netback for packets
> being transmitted is just 64.

That was fairly arbitrary, but 64 bytes is probably too small since it'll
keep IPv6 TCP headers out of the head area (2 + 14 + 40 + 28 > 64).  So we
want at least 128 bytes for both front and back.

> Also, your patch to netfront allocates a full page for each receive slot.
> The skbuff 'header' area is really not much used, except for the first
> RX_COPY_THRESHOLD bytes of each packet. Rather than allocating lots of
> skbuffs up front and then freeing most of them when you receive jumbo
> packets, why not just allocate the skbuff part in netif_poll, for each
> complete packet that you detect you have received, rather than doing it in
> network_alloc_rx_buffers?

The main reason for preallocation is to avoid unnecessary work.  When
the system is under memory pressure, if we postpone the allocation then
all the work done to move the packet from dom0 to the point where we are
would be wasted should the allocation fail at that point.

On the other, if the failure occurs during pre-allocation, then dom0
would not even get to place the skb into the ring since there would
be no room there.

I do concede that we're wasting effort in repeatedly initialising skb's
that we throw away in the case of jumbo packets.  We can remove that
waste by maintaining our own list of unused skb's that we can simply
put back on the ring in network_alloc_rx_buffers without going through
alloc_skb again.

> Alternatively we could go back to the old method of rx buffer allocation
> which allocates page-sized skbuff header areas, then unmaps the page
> containing skb->head. This would avoid the need for RX_COPY_THRESHOLD, but
> would constrain the location of the first packet fragment (since the skb
> header area needs 16 bytes headroom and tailroom for skb_shared_info) or
> we'd need a slow path to relocate the header fragment. What do you think?

I'd like avoid that because this relies on the internal structure of
sk_buff which may not stay the same as Linux evolves.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel