From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: netdev@vger.kernel.org, rusty@rustcorp.com.au,
xen-devel@lists.xensource.com, David Miller <davem@davemloft.net>,
eric.dumazet@gmail.com
Subject: Re: SKB paged fragment lifecycle on receive
Date: Mon, 27 Jun 2011 21:51:53 +0100 [thread overview]
Message-ID: <4E08ED69.3010709@goop.org> (raw)
In-Reply-To: <1309003121.5807.20.camel@dagon.hellion.org.uk>
On 06/25/2011 12:58 PM, Ian Campbell wrote:
> On Fri, 2011-06-24 at 13:11 -0700, Jeremy Fitzhardinge wrote:
>> On 06/24/2011 12:46 PM, David Miller wrote:
>>> Pages get transferred between different SKBs all the time.
>>>
>>> For example, GRO makes extensive use of this technique.
>>> See net/core/skbuff.c:skb_gro_receive().
>>>
>>> It is just one example.
>> I see, and the new skb doesn't get a destructor copied from the
>> original, so there'd be no second callback.
> What about if we were to have a per-shinfo destructor (called once for
> each page as its refcount goes 1->0, from whichever skb ends up with the
> last ref) as well as the skb-destructors.
We never want the refcount for granted pages to go from 1 -> 0. The
safest thing is to make sure we always elevate the refcount to make sure
that nothing else can ever drop the last ref.
If we can trust the network stack to always do the last release (and not
hand it off to something else to do it), then we could have a destructor
which gets called before the last ref drop (or leaves the ref drop to
the destructor to do), and do everything required that way. But it
seems pretty fragile. At the very least it would need a thorough code
audit to make sure that everything handles page lifetimes in the
expected way - but then I'd still worry about out-of-tree patches
breaking something in subtle ways.
> This already handles the
> cloning case but when pages are moved between shinfo then would it make
> sense for that to be propagated between skb's under these circumstances
> and/or require them to be the same? Since in the case of something like
> skb_gro_receive the skbs (and hence the frag array pages) are all from
> the same 'owner' (even if the skb is actually created by the stack on
> their behalf) I suspect this could work?
>
> But I bet this assumption isn't valid in all cases.
Hm.
> In which case I end up wondering about a destructor per page in the frag
> array. At which point we might as well consider it as a part of the core
> mm stuff rather than something net specific?
Doing it generically still needs some kind of marker that the page has a
special-case destructor (and the destructor pointer itself).
J
next prev parent reply other threads:[~2011-06-27 20:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 15:43 SKB paged fragment lifecycle on receive Ian Campbell
2011-06-24 15:43 ` Ian Campbell
2011-06-24 17:29 ` Jeremy Fitzhardinge
2011-06-24 17:56 ` Eric Dumazet
2011-06-24 18:21 ` Jeremy Fitzhardinge
2011-06-24 19:46 ` David Miller
2011-06-24 20:11 ` Jeremy Fitzhardinge
2011-06-24 20:27 ` David Miller
2011-06-25 11:58 ` Ian Campbell
2011-06-27 20:51 ` Jeremy Fitzhardinge [this message]
2011-06-28 10:25 ` Ian Campbell
2011-06-27 14:42 ` Ian Campbell
2011-06-27 22:49 ` David Miller
2011-06-28 10:24 ` Ian Campbell
2011-06-24 22:44 ` Ian Campbell
2011-06-24 22:48 ` Jeremy Fitzhardinge
2011-06-26 10:25 ` Michael S. Tsirkin
2011-06-27 9:41 ` Ian Campbell
2011-06-27 10:21 ` Michael S. Tsirkin
2011-06-27 10:54 ` Ian Campbell
2011-06-27 11:19 ` Michael S. Tsirkin
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=4E08ED69.3010709@goop.org \
--to=jeremy@goop.org \
--cc=Ian.Campbell@citrix.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.