public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: netdev <netdev@vger.kernel.org>
Subject: [RFC] truesize lies
Date: Sun, 09 Oct 2011 21:02:28 +0200	[thread overview]
Message-ID: <1318186948.5276.49.camel@edumazet-laptop> (raw)

I noticed on my laptop a difference if I use wifi or wired internet
connectivity.

On wifi mode, I can see netstat -s giving sign of bad rcvbuf tuning :

   371 packets collapsed in receive queue due to low socket buffer

After some analysis, I found full sized tcp skbs (len=1440) had a 2864
bytes truesize on my wifi adapter. Ouch...

On tg3 adapter, truesize is MTU + NET_SKB_PAD + sizeof(sk_buff).

On some devices (say... NIU, but other drivers have same problem :
bnx2x, ), truesize is sizeof(sk_buff) + frame_length.

So if 'truesize' really means to account exact memory cost of frames
(including the empty space after used part), I would say :

1) NIU is lying (it should account in niu_rx_skb_append() not the used
part of the page, but reserved part : PAGE_SIZE/rbr_blocks_per_page)

2) Autotuning is a bit pessimistic : It works only if truesize is MSS +
sizeof(sk_buff) + 16 + MAX_TCP_HEADER


I guess most driver writers adjust truesize to please TCP stack and get
nice performance numbers.

skb->truesize = frame_len + sizeof(sk_buff);

What should we do exactly ?

             reply	other threads:[~2011-10-09 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-09 19:02 Eric Dumazet [this message]
2011-10-09 19:25 ` [RFC] truesize lies Andi Kleen
2011-10-09 21:27 ` David Miller
2011-10-09 21:55   ` Eric Dumazet
2011-10-09 22:10     ` David Miller
2011-10-10  6:54       ` Eric Dumazet

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=1318186948.5276.49.camel@edumazet-laptop \
    --to=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