Received: with ECARTIS (v1.0.0; list netdev); Thu, 02 Sep 2004 15:04:28 -0700 (PDT) Received: from arnor.apana.org.au (mail@arnor.apana.org.au [203.14.152.115]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id i82M4HDs006026 for ; Thu, 2 Sep 2004 15:04:18 -0700 Received: from gondolin.me.apana.org.au ([192.168.0.6] ident=mail) by arnor.apana.org.au with esmtp (Exim 3.35 #1 (Debian)) id 1C2zgK-0007pN-00; Fri, 03 Sep 2004 08:03:48 +1000 Received: from herbert by gondolin.me.apana.org.au with local (Exim 3.36 #1 (Debian)) id 1C2zgG-0000vj-00; Fri, 03 Sep 2004 08:03:44 +1000 Date: Fri, 3 Sep 2004 08:03:44 +1000 To: "David S. Miller" Cc: Patrick McHardy , yoshfuji@linux-ipv6.org, netdev@oss.sgi.com Subject: Re: [PATCH 2.6]: Fix suboptimal fragment sizing for last fragment Message-ID: <20040902220343.GA3250@gondor.apana.org.au> References: <4137681D.3000902@trash.net> <20040902144436.2c8c1337.davem@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline In-Reply-To: <20040902144436.2c8c1337.davem@redhat.com> User-Agent: Mutt/1.5.6+20040722i From: Herbert Xu X-archive-position: 8365 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: herbert@gondor.apana.org.au Precedence: bulk X-list: netdev --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Sep 02, 2004 at 02:44:36PM -0700, David S. Miller wrote: > > I see only one remaining possible improvement. If the fraggap > area is paged data, we probably should try use page frags > in the new SKB if this split occurs in ip_append_page(). Yes. That could also tie into another optimisation. But it's an ugly one :) The sk->csum values are added up at the end of the processing so when we move bytes to and fro the total csum value stays the same even if the fragment csum values change. Therefore we can get rid of the csum adjustments except for the parity bit in the getfrag call. Is this an acceptable optimisation to you guys? Another thing we can do is to not always fill up the frags in the middle and then move bytes off them. As it is if you do a send that spans multiple packets each fragment will be filled up to the full and then chopped off when the next one is started. And to finish it off, here is a really trivial patch to shave off 27 bytes from the source code :) It does nothing else, well unless your compiler decides to compile csum_block_sub out-of-line. Signed-off-by: Herbert Xu Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p ===== net/ipv4/ip_output.c 1.65 vs edited ===== --- 1.65/net/ipv4/ip_output.c 2004-09-02 15:07:28 +10:00 +++ edited/net/ipv4/ip_output.c 2004-09-03 07:53:54 +10:00 @@ -896,8 +896,8 @@ skb->csum = skb_copy_and_csum_bits( skb_prev, maxfraglen, data + transhdrlen, fraggap, 0); - skb_prev->csum = csum_block_sub( - skb_prev->csum, skb->csum, 0); + skb_prev->csum = csum_sub(skb_prev->csum, + skb->csum); data += fraggap; skb_trim(skb_prev, maxfraglen); } @@ -1094,8 +1094,8 @@ skb->csum = skb_copy_and_csum_bits( skb_prev, maxfraglen, data, fraggap, 0); - skb_prev->csum = csum_block_sub( - skb_prev->csum, skb->csum, 0); + skb_prev->csum = csum_sub(skb_prev->csum, + skb->csum); skb_trim(skb_prev, maxfraglen); } ===== net/ipv6/ip6_output.c 1.70 vs edited ===== --- 1.70/net/ipv6/ip6_output.c 2004-09-02 15:07:29 +10:00 +++ edited/net/ipv6/ip6_output.c 2004-09-03 07:54:41 +10:00 @@ -985,8 +985,8 @@ skb->csum = skb_copy_and_csum_bits( skb_prev, maxfraglen, data + transhdrlen, fraggap, 0); - skb_prev->csum = csum_block_sub( - skb_prev->csum, skb->csum, 0); + skb_prev->csum = csum_sub(skb_prev->csum, + skb->csum); data += fraggap; skb_trim(skb_prev, maxfraglen); } --fdj2RfSjLxBAspz7--