From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757521AbaHZKze (ORCPT ); Tue, 26 Aug 2014 06:55:34 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:48811 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754369AbaHZKzd (ORCPT ); Tue, 26 Aug 2014 06:55:33 -0400 Message-ID: <1409050530.3173.12.camel@edumazet-glaptop2.roam.corp.google.com> Subject: RE: [PATCH v6 2/4] net: moxa: replace build_skb() with netdev_alloc_skb_ip_align() / memcpy() From: Eric Dumazet To: David Laight Cc: "'Arnd Bergmann'" , "linux-arm-kernel@lists.infradead.org" , Jonas Jensen , "netdev@vger.kernel.org" , "f.fainelli@gmail.com" , "linux-kernel@vger.kernel.org" , "mirqus@gmail.com" , "davem@davemloft.net" Date: Tue, 26 Aug 2014 03:55:30 -0700 In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1748126F@AcuExch.aculab.com> References: <1408544342-32058-1-git-send-email-jonas.jensen@gmail.com> <1408976542-15624-1-git-send-email-jonas.jensen@gmail.com> <4449672.aCJ5J5rv4r@wuerfel> <063D6719AE5E284EB5DD2968C1650D6D1748126F@AcuExch.aculab.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2014-08-26 at 09:10 +0000, David Laight wrote: > From: Arnd Bergmann > > While this seems correct, I wonder why you don't do the normal approach of > > dequeuing the skb from the chain and adding a newly allocated skb to it to > > save the memcpy. > > Because the receive buffer area isn't made of skbs. > Post-allocating the skb also reduces the 'true size' of the skb. This strategy assumes this is not a 10Gbe NIC. We try to avoid copies because they are generally not needed. Wifi devices are usually slow, and packet losses are more frequent, so the copybreak gives better chance to not doing the collapses [1] later in the TCP stack. [1] collapses : reducing skb overhead (skb->len / skb->truesize ratio)