netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: vladislav.yasevich@hp.com
Cc: netdev@vger.kernel.org
Subject: Re: rewriting skb->truesize... good or bad idea
Date: Tue, 03 Oct 2006 16:21:53 -0700 (PDT)	[thread overview]
Message-ID: <20061003.162153.06584617.davem@davemloft.net> (raw)
In-Reply-To: <45212652.5030505@hp.com>

From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Mon, 02 Oct 2006 10:46:42 -0400

> David Miller wrote:
> > If, on the other hand, you know you have exclusive access to the
> > skb and there are no other references, setting skb->truesize can
> > be OK.  However setting it to sizeof(struct sk_buff) doesn't make
> > sense since there is at least:
> > 
> > 	sizeof(struct sk_buff) + sizeof(struct skb_shared_info)
> > 
> > memory assosciated with any SKB whatsoever in the kernel.  That is,
> > even for a "zero length" skb->data buffer, we still always allocate
> > the skb_shared_info area which must be accounted for.
> 
> Well, since we are dealing with clones of the original skb, I didn't
> think that we need to include skb_shared_info.  I thought that was
> accounted for in the original skb?

We use the original packet's truesize, as-is, when making
SKB clones.  This is our global policy.

The reason for that behavior is the usual case is that the
clone is being attached to a different socket than the
original SKB will.  And we very much should charge the memory
fully to every socket that references it.

In your case it seems that the memory is already charged to
the socket, and we would just be charging that memory again
to the same socket.  So in this very specific case, it should
be OK not to include skb_shared_info in the truesize calculation.


      reply	other threads:[~2006-10-03 23:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-29 18:16 rewriting skb->truesize... good or bad idea Vlad Yasevich
2006-09-29 21:31 ` David Miller
2006-10-02 14:46   ` Vlad Yasevich
2006-10-03 23:21     ` David Miller [this message]

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=20061003.162153.06584617.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=vladislav.yasevich@hp.com \
    /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).