netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Brice Goglin <Brice.Goglin@ens-lyon.org>
Cc: netdev@vger.kernel.org
Subject: Re: Who's allowed to set a skb destructor?
Date: 05 Jul 2007 12:08:27 +0200	[thread overview]
Message-ID: <p733b032mec.fsf@bingen.suse.de> (raw)
In-Reply-To: <468B54A6.5090902@ens-lyon.org>

Brice Goglin <Brice.Goglin@ens-lyon.org> writes:

> I am trying to understand whether I can setup a skb destructor in my
> code (which is basically a protocol above dev_queue_xmit() and co). From
> what I see in many parts in the current kernel code, the "protocol" (I
> mean, the one who actually creates the skb) may setup a destructor.

The socket layer generally needs it for its own accounting.
Unless you never pass it up you can't use it.

> However, I also see some places where some low-level drivers might be
> using a destructor too , without apparently checking whether an upper
> layer already uses one. For instance, write_ofld_wr() in cxgb3/sge.c.

Likely a bug. Normally that should not slip past code review.

> found some old threads about adding support for multiple destructors but
> I don't see anything like this in the current kernel.
> 
> So, I'd like to have a clear statement about who's allowed to use a
> destructor :)

The traditional standpoint was that having your own large skb pools 
is not recommended because you won't interact well with the 
rest of the system running low on memory and you tieing up 
memory.

Essentially you would recreate all the problems traditional Unix
systems have with fixed size mbuf pools. Linux always used a more
dynamic and flexible allocate-only-as-you-need approach even when it
can have a little more overhead in managing IOMMUs etc.

These days there are shrinker callbacks that would in theory
allow you to handle this, but it would be likely still hard to implement
correctly.

-Andi

  parent reply	other threads:[~2007-07-05  9:13 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 [this message]
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

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=p733b032mec.fsf@bingen.suse.de \
    --to=andi@firstfloor.org \
    --cc=Brice.Goglin@ens-lyon.org \
    --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).