netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@o2.pl>
To: Andi Kleen <andi@firstfloor.org>
Cc: Brice Goglin <Brice.Goglin@ens-lyon.org>,
	netdev@vger.kernel.org, Evgeniy Polyakov <johnpol@2ka.mipt.ru>,
	Divy Le Ray <divy@chelsio.com>
Subject: Re: Who's allowed to set a skb destructor?
Date: Fri, 6 Jul 2007 09:47:20 +0200	[thread overview]
Message-ID: <20070706074720.GA2362@ff.dom.local> (raw)
In-Reply-To: <20070705130640.GA24731@one.firstfloor.org>

On Thu, Jul 05, 2007 at 03:06:40PM +0200, Andi Kleen wrote:
> On Thu, Jul 05, 2007 at 02:28:50PM +0200, Jarek Poplawski wrote:
> > I wonder if it's very unsound to think about a one way list
> > of destructors. Of course, not owners could only clean their
> > private allocations. Woudn't this save some skb clonning,
> > copying or adding new fields for private infos?
> 
> skb cloning isn't very expensive when you need it. And they
> got a little private area you can use for your own stuff 
> while you have it queued (skb->cb) 
> 
> As a historical note one of the big changes during the Linux 2.0
> and 2.1 TCP rewrite was that TCP was changed to always clone for the
> retransmit queue. This cleaned up the code greatly and fixed
> many problems. Cloning was also especially optimized for this. When TCP 
> which is about one of the most performance critical protocols around can 
> afford it likely other code can too.

I've thought about this a bit more, and, if I don't miss something,
there is a possibility to use these things together: let's imagine
such simplified api:

- a driver which needs a bit of space to track skbs in a few places,
  registers itself with some function telling the size, maybe a
  callback/destructor and maybe a protocol id; some index is returned;
- if this is the first one registered, api allocates new space using
  skb clonning or some similar slab pool, to get blank space, and
  reserves space for this driver according to the index (internally
  mapped to some offset); since this moment every new skb is
  automatically 'cloned' and the driver can read/write its place using
  the api to map the requests;
- next registered drivers use the same 'clone', unless there is no
  more space, so next 'clones' are generated;
- the lifetime of such 'clones' is controlled similarly to the 'real 
  clones'; with the most basic version destructors could be avoided;
- some indexes could be made public constants to allow sharing.

Is this wrong?

Regards,
Jarek P.

      parent reply	other threads:[~2007-07-06  7:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04  8:04 Who's allowed to set a skb destructor? Brice Goglin
2007-07-04  9:38 ` Evgeniy Polyakov
2007-07-05 10:08 ` Andi Kleen
2007-07-05 11:07   ` Divy Le Ray
2007-07-05 13:07     ` Andi Kleen
2007-07-05 12:28   ` Jarek Poplawski
2007-07-05 12:28     ` Evgeniy Polyakov
2007-07-05 13:00       ` Jarek Poplawski
2007-07-06  9:08       ` Jarek Poplawski
2007-07-06  9:44         ` Jarek Poplawski
2007-07-05 13:06     ` Andi Kleen
2007-07-05 13:51       ` Jarek Poplawski
2007-07-06  7:47       ` Jarek Poplawski [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=20070706074720.GA2362@ff.dom.local \
    --to=jarkao2@o2.pl \
    --cc=Brice.Goglin@ens-lyon.org \
    --cc=andi@firstfloor.org \
    --cc=divy@chelsio.com \
    --cc=johnpol@2ka.mipt.ru \
    --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).