Netdev List
 help / color / mirror / Atom feed
From: kristrev@student.matnat.uio.no
To: netdev@vger.kernel.org
Subject: SKBs with shared fragments
Date: Tue, 29 Jan 2008 17:17:08 +0100 (CET)	[thread overview]
Message-ID: <34241.129.240.228.53.1201623428.squirrel@webmail.uio.no> (raw)

Hello,

I am working on a patch to the TCP-code that, among others, share
fragments between skbs, and have encountered a problem that I'm not sure
if I have solved correctly.

To share a fragment, I copy the skb_frag-struct to the correct place in
the other skbs frags-array, increase the page-counter, skb->data_len,
skb->len, skb->end_seq and gso_segs/gso_size, and calculate a new
checksum.

The problem is the skb->truesize-variable. Currently I do not increase it,
leading to a SKB BUG because truesize is less than (skb->len +
sizeof(struct skb)). When I increase/decrease truesize, both the
wmem_queue and sk_forward_alloc is something else than zero and the socket
leaks memory.

The kernel does not halt and all the data is received correctly in both
cases.

The reason that I currently don't increase/decrease truesize is that, at
least if I have understod the code correctly, truesize says something
about how much memory an skb actually consumes. And since I only copy
existing fragments into it, I don't use any more memory.

Is this correct, or should I increase/decrease truesize as well? Also, is
there a better way to share fragments between skbs?

Thanks in advance for any replies,
Kristian


                 reply	other threads:[~2008-01-29 16:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=34241.129.240.228.53.1201623428.squirrel@webmail.uio.no \
    --to=kristrev@student.matnat.uio.no \
    --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