netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: rusty@rustcorp.com.au
Cc: netdev@vger.kernel.org, maxk@qualcomm.com, herbert@gondor.apana.org.au
Subject: Re: [PATCH] net: add destructor for skb data (rewritten)
Date: Sat, 19 Apr 2008 02:35:24 -0700 (PDT)	[thread overview]
Message-ID: <20080419.023524.75551453.davem@davemloft.net> (raw)
In-Reply-To: <200804181421.25828.rusty@rustcorp.com.au>

From: Rusty Russell <rusty@rustcorp.com.au>
Date: Fri, 18 Apr 2008 14:21:25 +1000

> If we want to notify something when an skb is truly finished (such as
> for tun vringfd support), we need a destructor on the data.
> 
> This turns out to be slightly non-trivial as fragments from one skb
> get copied to another skb: if the first skb has a destructor (or its
> parent does) we need to keep a reference to it and destroy it only
> when (all the) children are destroyed.  We add an 'orig' pointer to
> the skb_shared_info to do this.
> 
> But there's currently no way to get from the shinfo to the head (to
> kfree it), so we add a 'len' field.  A better alternative to this
> might be to move the skb_shared_info to before the head of the skb data.
> 
> Note that the destructor is responsible for calling kfree: for the tun
> device, this is critical since the destructor can be called from any
> context and it has to do a copy_to_user, so it queues the skb.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

I'm mostly ambivalent but I will say I'm not happy about all of this
extra state you're adding even though it's "only" to the SKB data
shared-info struct and not sk_buff properly.

Does this handle SKB frags of arbitrary depth?  SKB's can be nested to
arbitrary depths via the frag mechanism.

  reply	other threads:[~2008-04-19  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18  4:21 [PATCH] net: add destructor for skb data (rewritten) Rusty Russell
2008-04-19  9:35 ` David Miller [this message]
2008-04-19 16:20   ` Rusty Russell
2008-04-19  9:46 ` Evgeniy Polyakov
2008-04-19 15:49   ` Rusty Russell

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=20080419.023524.75551453.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=maxk@qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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).