netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Krause <mathias.krause@secunet.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"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: Thu, 07 Nov 2013 09:56:31 +0100	[thread overview]
Message-ID: <527B55BF.2090502@secunet.com> (raw)
In-Reply-To: <1383755989.4291.178.camel@edumazet-glaptop2.roam.corp.google.com>

On 06.11.2013 17:39, Eric Dumazet wrote:
> On Wed, 2013-11-06 at 20:48 +0800, Herbert Xu wrote:
>> On Wed, Nov 06, 2013 at 01:42:03PM +0100, Mathias Krause wrote:
>>> 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.
>> Whenever we say page it means nr_frags != 0.  So currently as
>> long as we have pages in our skb we will copy.  With your patch
>> we will no longer copy in the case where we have pages but the
>> skb isn't cloned.  In fact that is the whole point of your patch.
>>
>>> 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".
>> As I said you don't know where the page in the skb came from.  It
>> may point to read-only memory or memory that's shared with another
>> task that isn't expecting things to change underneath it.
> 
> Note that we might have now a per skb flag telling is all page frags are
> owned.
> 
> This is SKBTX_SHARED_FRAG
> 
> If SKBTX_SHARED_FRAG is set on shared_info->tx_flags, then at least
> one frag is not safe and we must copy all frags.
> 
> 
> For example, this flag is set in TCP sendfile() path (vmsplice()...),
> and zero copy paths in general (macvtap, tun)
> 
> I am not 100% sure, but this could be a hint.

Thanks for the hint, Eric!


Mathias

  reply	other threads:[~2013-11-07  8:56 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
2013-11-06 12:48           ` Herbert Xu
2013-11-06 16:39             ` Eric Dumazet
2013-11-07  8:56               ` Mathias Krause [this message]
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=527B55BF.2090502@secunet.com \
    --to=mathias.krause@secunet.com \
    --cc=davem@davemloft.net \
    --cc=dmitry.tarnyagin@lockless.no \
    --cc=eric.dumazet@gmail.com \
    --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 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).