netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH 2/6] net: pad skb data and shinfo as a whole rather than individually
Date: Fri, 6 Jan 2012 13:20:01 +0000	[thread overview]
Message-ID: <1325856001.25206.493.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <1325853226.2999.19.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Fri, 2012-01-06 at 12:33 +0000, Eric Dumazet wrote:
> Le vendredi 06 janvier 2012 à 11:20 +0000, Ian Campbell a écrit :
> 
> > It doesn't fit in a single cache line today.
> 
> It really does, thanks to your (net: pack skb_shared_info more
> efficiently) previous patch.
> 
> I dont understand your numbers, very hard to read.
> 
> Current net-next :
> 
> offsetof(struct skb_shared_info, nr_frags)=0x0
> offsetof(struct skb_shared_info, frags[1])=0x40   (0x30 on 32bit arches)

I see 0x48 here at cset 6386994e03ebbe60338ded3d586308a41e81c0dc:
(gdb) print &((struct skb_shared_info *)0)->nr_frags
$1 = (short unsigned int *) 0x0
(gdb) print &((struct skb_shared_info *)0)->frags[1]
$2 = (skb_frag_t *) 0x48
(gdb) print &((struct skb_shared_info *)0)->frags[0]
$3 = (skb_frag_t *) 0x38

(it's 0x34 and 0x2c on 32 bit) and these numbers match what I posted for
v3.1 (and I imagine earlier since this stuff doesn't seem to change very
often).

I provided the offsets of each field in struct skb_shared_info, which
one do you think is wrong?

Remember that the end shared info is explicitly aligned (to the end of
the allocation == a cache line) while the front just ends up at wherever
the size dictates so you can't measure the alignment of the fields from
the beginning  of the struct, you need to measure from the end.

Ian.

> So _all_ fields, including one frag, are included in a single cache line
> on most machines (64-bytes cache line), IF struct skb_shared_info is
> aligned.
> 
> Your patch obviously breaks this on 64bit arches, unless you make sure
> sizeof(struct skb_shared_info) is a multiple of cache line.
> 
> [BTW, it is incidentaly the case after your 1/6 patch]
> 
> fields reordering is not going to change anything on this.
> 
> Or maybe I misread your patch ?
> 
> At least you claimed in Changelog : 
> 
> <quote>
>  Reducing this overhead means that sometimes the tail end of
>  the data can end up in the same cache line as the beginning of the shinfo but
>  in many cases the allocation slop means that there is no overlap.
> </quote>
> 
> 
> 

  reply	other threads:[~2012-01-06 13:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 17:09 [PATCH 0/6 v2] skb paged fragment destructors Ian Campbell
2012-01-05 17:13 ` [PATCH 1/6] net: pack skb_shared_info more efficiently Ian Campbell
2012-01-05 18:30   ` Eric Dumazet
2012-01-05 19:09     ` David Miller
2012-01-05 17:13 ` [PATCH 2/6] net: pad skb data and shinfo as a whole rather than individually Ian Campbell
2012-01-05 17:46   ` Eric Dumazet
2012-01-05 19:13     ` David Miller
2012-01-05 20:00       ` Ian Campbell
2012-01-07 18:18         ` David Miller
2012-01-05 19:19     ` Ian Campbell
2012-01-05 20:22       ` Eric Dumazet
2012-01-06 11:20         ` Ian Campbell
2012-01-06 12:33           ` Eric Dumazet
2012-01-06 13:20             ` Ian Campbell [this message]
2012-01-06 13:37               ` Eric Dumazet
2012-01-06 13:49                 ` Ian Campbell
2012-01-06 13:29             ` Ian Campbell
2012-01-05 17:13 ` [PATCH 3/6] net: add support for per-paged-fragment destructors Ian Campbell
2012-01-06  1:15   ` Michał Mirosław
2012-01-06  8:50     ` Ian Campbell
2012-01-05 17:13 ` [PATCH 4/6] net: only allow paged fragments with the same destructor to be coalesced Ian Campbell
2012-01-05 17:13 ` [PATCH 5/6] net: add paged frag destructor support to kernel_sendpage Ian Campbell
2012-01-05 19:15   ` David Miller
2012-01-05 20:04     ` Ian Campbell
     [not found] ` <1325783399.25206.413.camel-o4Be2W7LfRlXesXXhkcM7miJhflN2719@public.gmane.org>
2012-01-05 17:13   ` [PATCH 6/6] sunrpc: use SKB fragment destructors to delay completion until page is released by network stack Ian Campbell
2012-01-05 17:27 ` [PATCH 0/6 v2] skb paged fragment destructors David Laight
2012-01-05 17:34   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325856001.25206.493.camel@zakaz.uk.xensource.com \
    --to=ian.campbell@citrix.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).