summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-04-19 09:38:17 (GMT)
committerDavid S. Miller <davem@davemloft.net>2012-04-21 20:36:42 (GMT)
commite66e9a31474dcce5be6f1186dc933d8a991c707b (patch)
tree10bcd8dd605738689797656753ecbbbbab33fe23
parentacd69962341a956b5bcc5b4178b70fa527d7ce11 (diff)
downloadlinux-e66e9a31474dcce5be6f1186dc933d8a991c707b.tar.xz
net: allow better page reuse in splice(sock -> pipe)
splice() from socket to pipe needs linear_to_page() helper to transfert skb header to part of page. We can reset the offset in the current sk->sk_sndmsg_page if we are the last user of the page. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/skbuff.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 43c490d..bf257de 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1565,6 +1565,9 @@ new_page:
} else {
unsigned int mlen;
+ /* If we are the only user of the page, we can reset offset */
+ if (page_count(p) == 1)
+ sk->sk_sndmsg_off = 0;
off = sk->sk_sndmsg_off;
mlen = PAGE_SIZE - off;
if (mlen < 64 && mlen < *len) {