Skip to content

Commit

Permalink
net: allow better page reuse in splice(sock -> pipe)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed Apr 21, 2012
1 parent acd6996 commit e66e9a3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,9 @@ static inline struct page *linear_to_page(struct page *page, unsigned int *len,
} 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) {
Expand Down

0 comments on commit e66e9a3

Please sign in to comment.