All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Krause <mathias.krause@secunet.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next 3/3] net: allow to leave the buffer fragmented in skb_cow_data()
Date: Wed, 06 Nov 2013 13:42:03 +0100	[thread overview]
Message-ID: <527A391B.4050907@secunet.com> (raw)
In-Reply-To: <20131106095217.GA18851@gondor.apana.org.au>

On 06.11.2013 10:52, Herbert Xu wrote:
> On Wed, Nov 06, 2013 at 10:49:18AM +0100, Mathias Krause wrote:
>> On 06.11.2013 10:30, Herbert Xu wrote:
>>
>>> Hang on, you haven't explained why it is OK to write to pages.
>> Why wouldn't it if the skb isn't cloned?
> 
> Because if it's owned by an entity outside our stack (e.g., virt
> host or app) then the skb itself won't be cloned.

Ok.

>>> What if said page is owned by the virt host or some app?
>> How would one detect such a case. I could image not by testing
>> skb_shinfo(skb)->nr_frags as it is right now?
> 
> You can't.  That's why we always copy.

Well, skb_cow_data() will only copy, i.e. call __pskb_pull_tail(), in
case the skb is either cloned or fragmented. As you already said it
won't be cloned in your case. Does it contain fragments, i.e. is
skb_shinfo(skb)->nr_frags != 0? If not, we won't copy with the current
code either.

We *will* copy, though, if we're expected to expand the tailroom. That
won't change in my patch as we'll linearize the skb in that case -- even
if there would enough room in the skb. That's needed to not hit the
SKB_LINEAR_ASSERT(skb) in skb_put().

> If you want to do this
> properly then we'll need to add at least a bit to indicate whether
> the page originated from within the network stack and we have
> full ownership.

Can you please explain why this would be needed? I still don't get the
reasoning behind "pages are considered not writable at the moment even
if they are anonymous".

skb_cow_data() is only used in those places:

- net/caif/cfpkt_skbuff.c
- net/ipv4/ah4.c
- net/ipv4/esp4.c
- net/ipv6/ah6.c
- net/ipv6/esp6.c
- net/rxrpc/rxkad.c

Can you explain how this change would be a problem for them?


Thanks,
Mathias

  reply	other threads:[~2013-11-06 12:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 13:54 [PATCH net-next 0/3] IPsec improvements Mathias Krause
2013-11-05 13:54 ` [PATCH net-next 1/3] net: move pskb_put() to core code Mathias Krause
2013-11-05 18:33   ` Ben Hutchings
2013-11-06  9:01     ` Mathias Krause
2013-11-05 13:54 ` [PATCH net-next 2/3] caif: use pskb_put() instead of reimplementing its functionality Mathias Krause
2013-11-05 13:54 ` [PATCH net-next 3/3] net: allow to leave the buffer fragmented in skb_cow_data() Mathias Krause
2013-11-05 14:33   ` Eric Dumazet
2013-11-05 14:43     ` Mathias Krause
2013-11-06  9:30   ` Herbert Xu
2013-11-06  9:49     ` Mathias Krause
2013-11-06  9:52       ` Herbert Xu
2013-11-06 12:42         ` Mathias Krause [this message]
2013-11-06 12:48           ` Herbert Xu
2013-11-06 16:39             ` Eric Dumazet
2013-11-07  8:56               ` Mathias Krause
2013-11-07  8:55             ` Mathias Krause
2013-11-07  9:01               ` Herbert Xu
2013-11-07 10:01                 ` Mathias Krause
2013-11-06  4:48 ` [PATCH net-next 0/3] IPsec improvements David Miller
2013-11-06  9:02   ` Mathias Krause

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=527A391B.4050907@secunet.com \
    --to=mathias.krause@secunet.com \
    --cc=davem@davemloft.net \
    --cc=dmitry.tarnyagin@lockless.no \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.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.