From: Eric Dumazet Date: Thu, 19 Apr 2012 09:38:17 +0000 (+0000) Subject: net: allow better page reuse in splice(sock -> pipe) X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e66e9a31474dcce5be6f1186dc933d8a991c707b;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Signed-off-by: David S. Miller --- diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 43c490d52df..bf257de95d2 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) {