From: Eric Dumazet <eric.dumazet@gmail.com>
To: Willy Tarreau <w@1wt.eu>, David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: [PATCH net-next] net: splice: fix __splice_segment()
Date: Fri, 11 Jan 2013 16:46:37 -0800 [thread overview]
Message-ID: <1357951597.20249.247.camel@edumazet-glaptop> (raw)
In-Reply-To: <1357831787.27446.2168.camel@edumazet-glaptop>
From: Eric Dumazet <edumazet@google.com>
commit 9ca1b22d6d2 (net: splice: avoid high order page splitting)
forgot that skb->head could need a copy into several page frags.
This could be the case for loopback traffic mostly.
Also remove now useless skb argument from linear_to_page()
and __splice_segment() prototypes.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willy Tarreau <w@1wt.eu>
---
net/core/skbuff.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1e1b9ea..2568c44 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1652,7 +1652,7 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
static struct page *linear_to_page(struct page *page, unsigned int *len,
unsigned int *offset,
- struct sk_buff *skb, struct sock *sk)
+ struct sock *sk)
{
struct page_frag *pfrag = sk_page_frag(sk);
@@ -1685,14 +1685,14 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd,
static bool spd_fill_page(struct splice_pipe_desc *spd,
struct pipe_inode_info *pipe, struct page *page,
unsigned int *len, unsigned int offset,
- struct sk_buff *skb, bool linear,
+ bool linear,
struct sock *sk)
{
if (unlikely(spd->nr_pages == MAX_SKB_FRAGS))
return true;
if (linear) {
- page = linear_to_page(page, len, &offset, skb, sk);
+ page = linear_to_page(page, len, &offset, sk);
if (!page)
return true;
}
@@ -1711,13 +1711,11 @@ static bool spd_fill_page(struct splice_pipe_desc *spd,
static bool __splice_segment(struct page *page, unsigned int poff,
unsigned int plen, unsigned int *off,
- unsigned int *len, struct sk_buff *skb,
+ unsigned int *len,
struct splice_pipe_desc *spd, bool linear,
struct sock *sk,
struct pipe_inode_info *pipe)
{
- unsigned int flen;
-
if (!*len)
return true;
@@ -1732,12 +1730,16 @@ static bool __splice_segment(struct page *page, unsigned int poff,
plen -= *off;
*off = 0;
- flen = min(*len, plen);
-
- if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
- return true;
+ do {
+ unsigned int flen = min(*len, plen);
- *len -= flen;
+ if (spd_fill_page(spd, pipe, page, &flen, poff,
+ linear, sk))
+ return true;
+ poff += flen;
+ plen -= flen;
+ *len -= flen;
+ } while (*len && plen);
return false;
}
@@ -1760,7 +1762,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
if (__splice_segment(virt_to_page(skb->data),
(unsigned long) skb->data & (PAGE_SIZE - 1),
skb_headlen(skb),
- offset, len, skb, spd,
+ offset, len, spd,
skb_head_is_locked(skb),
sk, pipe))
return true;
@@ -1773,7 +1775,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
if (__splice_segment(skb_frag_page(f),
f->page_offset, skb_frag_size(f),
- offset, len, skb, spd, false, sk, pipe))
+ offset, len, spd, false, sk, pipe))
return true;
}
next prev parent reply other threads:[~2013-01-12 0:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 13:01 tainted warnings with tcp splicing in 3.7.1 Christian Becker
2013-01-09 14:50 ` Lukas Tribus
2013-01-09 17:01 ` Eric Dumazet
2013-01-09 17:09 ` Eric Dumazet
2013-01-10 6:59 ` Eric Dumazet
2013-01-10 7:21 ` Willy Tarreau
2013-01-10 15:29 ` Eric Dumazet
2013-01-10 16:20 ` Eric Dumazet
2013-01-10 18:22 ` Rick Jones
2013-01-10 18:42 ` Eric Dumazet
2013-01-10 18:49 ` Rick Jones
2013-01-10 19:43 ` Willy Tarreau
2013-01-12 0:46 ` Eric Dumazet [this message]
2013-01-12 0:48 ` [PATCH net-next] net: splice: fix __splice_segment() David Miller
2013-01-10 18:27 ` tainted warnings with tcp splicing in 3.7.1 Lukas Tribus
2013-01-10 18:37 ` Eric Dumazet
2013-01-10 22:39 ` David Miller
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=1357951597.20249.247.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=w@1wt.eu \
/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