From patchwork Thu Sep 23 15:06:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 65538 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CCF54B70DB for ; Fri, 24 Sep 2010 01:07:03 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753874Ab0IWPG7 (ORCPT ); Thu, 23 Sep 2010 11:06:59 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:48245 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753155Ab0IWPG6 (ORCPT ); Thu, 23 Sep 2010 11:06:58 -0400 Received: by fxm3 with SMTP id 3so100109fxm.19 for ; Thu, 23 Sep 2010 08:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=2swf3i+PMJJ21lbza4ibHT7/lvHwXYEahvXsOSqkneA=; b=bYa2puhKJ1hryzoojPxuVOU6aHi7SHGftzGLNgN+bOWsbCwG5n/UhBqLR+3VmaktaR GjUGFiViH9OXyLJj7fCkuqnkO/3deKoWmK8/AX0eBA2bI4RGkq/zAZ3VGNUNjxIc4Wt7 n9d5icMW5DutR+6EGbCJJCvVpfa+Wtztjy+lo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=nZUQeZUAY0EVnZx+pzvuwScWh5NqKtJOMLZRtcncsIga+zx6Wtb9tmdnAIRdRLtjUf H1n22vOF5CdlM8rS9STmmDWU9FIjJJrV7MiZrwM3ilUOWaVERhCBWGOBAvEtVSFq/N5Q dNZf7KRKQzgUMIEquZDIaHYpAbYr9y+BfPSW4= Received: by 10.103.49.13 with SMTP id b13mr249593muk.86.1285254416941; Thu, 23 Sep 2010 08:06:56 -0700 (PDT) Received: from [10.150.51.224] (gw0.net.jmsp.net [212.23.165.14]) by mx.google.com with ESMTPS id m17sm17528fag.0.2010.09.23.08.06.55 (version=SSLv3 cipher=RC4-MD5); Thu, 23 Sep 2010 08:06:56 -0700 (PDT) Subject: [PATCH net-next-2.6] net: skb_frag_t can be smaller on small arches From: Eric Dumazet To: David Miller Cc: netdev Date: Thu, 23 Sep 2010 17:06:54 +0200 Message-ID: <1285254414.2509.50.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org David I remember you reacted on my three years old comment about commit a309bb072b96bfe (Page offsets and lengths need to be __u32.) http://www.mail-archive.com/netdev@vger.kernel.org/msg43999.html Could we reconsider the thing now and allow to shrink sizeof(skb_shared_info) from 0x104 to 0xbc, considering nothing happened about scatterlist work ? This saves 128 bytes on i386 because of alignments, and can be reverted pretty fast if needed. Thanks ! [PATCH net-next-2.6] net: skb_frag_t can be smaller on small arches On 32bit arches, if PAGE_SIZE is smaller than 65536, we can use 16bit offset and size fields. This patch saves 72 bytes per skb on i386, or 128 bytes after rounding. Signed-off-by: Eric Dumazet --- include/linux/skbuff.h | 5 +++++ 1 files changed, 5 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 9e8085a..9a7ea70 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -129,8 +129,13 @@ typedef struct skb_frag_struct skb_frag_t; struct skb_frag_struct { struct page *page; +#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536) __u32 page_offset; __u32 size; +#else + __u16 page_offset; + __u16 size; +#endif }; #define HAVE_HW_TIME_STAMP