Skip to content

Commit e66e9a3

Browse files
Eric Dumazetdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent acd6996 commit e66e9a3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/core/skbuff.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,9 @@ static inline struct page *linear_to_page(struct page *page, unsigned int *len,
15651565
} else {
15661566
unsigned int mlen;
15671567

1568+
/* If we are the only user of the page, we can reset offset */
1569+
if (page_count(p) == 1)
1570+
sk->sk_sndmsg_off = 0;
15681571
off = sk->sk_sndmsg_off;
15691572
mlen = PAGE_SIZE - off;
15701573
if (mlen < 64 && mlen < *len) {

0 commit comments

Comments
 (0)