From: Eric Dumazet <eric.dumazet@gmail.com>
To: Willy Tarreau <w@1wt.eu>, David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next] net: splice: avoid high order page splitting
Date: Sat, 05 Jan 2013 23:31:18 -0800 [thread overview]
Message-ID: <1357457478.1678.5928.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130106025256.GY16031@1wt.eu>
From: Eric Dumazet <edumazet@google.com>
splice() can handle pages of any order, but network code tries hard to
split them in PAGE_SIZE units. Not quite successfully anyway, as
__splice_segment() assumed poff < PAGE_SIZE. This is true for
the skb->data part, not necessarily for the fragments.
This patch removes this logic to give the pages as they are in the skb.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willy Tarreau <w@1wt.eu>
---
net/core/skbuff.c | 38 +++++++++-----------------------------
1 file changed, 9 insertions(+), 29 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index bc96100..b03fc0c 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1707,20 +1707,6 @@ static bool spd_fill_page(struct splice_pipe_desc *spd,
return false;
}
-static inline void __segment_seek(struct page **page, unsigned int *poff,
- unsigned int *plen, unsigned int off)
-{
- unsigned long n;
-
- *poff += off;
- n = *poff / PAGE_SIZE;
- if (n)
- *page = nth_page(*page, n);
-
- *poff = *poff % PAGE_SIZE;
- *plen -= off;
-}
-
static bool __splice_segment(struct page *page, unsigned int poff,
unsigned int plen, unsigned int *off,
unsigned int *len, struct sk_buff *skb,
@@ -1728,6 +1714,8 @@ static bool __splice_segment(struct page *page, unsigned int poff,
struct sock *sk,
struct pipe_inode_info *pipe)
{
+ unsigned int flen;
+
if (!*len)
return true;
@@ -1738,24 +1726,16 @@ static bool __splice_segment(struct page *page, unsigned int poff,
}
/* ignore any bits we already processed */
- if (*off) {
- __segment_seek(&page, &poff, &plen, *off);
- *off = 0;
- }
-
- do {
- unsigned int flen = min(*len, plen);
+ poff += *off;
+ plen -= *off;
+ *off = 0;
- /* the linear region may spread across several pages */
- flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
+ flen = min(*len, plen);
- if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
- return true;
-
- __segment_seek(&page, &poff, &plen, flen);
- *len -= flen;
+ if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
+ return true;
- } while (*len && plen);
+ *len -= flen;
return false;
}
next prev parent reply other threads:[~2013-01-06 7:31 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-05 21:49 Major network performance regression in 3.7 Willy Tarreau
2013-01-05 23:18 ` Eric Dumazet
2013-01-05 23:29 ` Willy Tarreau
2013-01-06 0:02 ` Eric Dumazet
2013-01-06 0:50 ` Willy Tarreau
2013-01-06 1:21 ` Eric Dumazet
2013-01-06 1:30 ` Willy Tarreau
2013-01-06 1:40 ` Eric Dumazet
2013-01-06 1:51 ` Eric Dumazet
2013-01-06 2:16 ` Eric Dumazet
2013-01-06 2:18 ` Willy Tarreau
2013-01-06 2:22 ` Eric Dumazet
2013-01-06 2:32 ` Willy Tarreau
2013-01-06 2:44 ` Eric Dumazet
2013-01-06 2:52 ` Willy Tarreau
2013-01-06 7:31 ` Eric Dumazet [this message]
2013-01-07 5:07 ` [PATCH net-next] net: splice: avoid high order page splitting David Miller
2013-01-06 7:35 ` Major network performance regression in 3.7 Eric Dumazet
2013-01-06 9:24 ` Willy Tarreau
2013-01-06 10:25 ` Willy Tarreau
2013-01-06 11:46 ` Romain Francoise
2013-01-06 11:53 ` Willy Tarreau
2013-01-06 12:01 ` Willy Tarreau
2013-01-06 14:59 ` Eric Dumazet
2013-01-06 15:51 ` Willy Tarreau
2013-01-06 16:39 ` Eric Dumazet
2013-01-06 16:44 ` Willy Tarreau
2013-01-06 17:10 ` Eric Dumazet
2013-01-06 17:35 ` Willy Tarreau
2013-01-06 18:39 ` Eric Dumazet
2013-01-06 18:43 ` Eric Dumazet
2013-01-06 18:51 ` Eric Dumazet
2013-01-06 19:00 ` Eric Dumazet
2013-01-06 19:34 ` Willy Tarreau
2013-01-06 19:39 ` Eric Dumazet
2013-01-06 19:53 ` Willy Tarreau
2013-01-07 4:21 ` [PATCH] tcp: fix MSG_SENDPAGE_NOTLAST logic Eric Dumazet
2013-01-07 4:59 ` David Miller
2013-01-06 21:49 ` Major network performance regression in 3.7 John Stoffel
2013-01-06 21:52 ` Willy Tarreau
2013-01-06 21:55 ` John Stoffel
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=1357457478.1678.5928.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