提交 789762ce 编写于 作者: S Soheil Hassas Yeganeh 提交者: David S. Miller

tcp: adjust rcv zerocopy hints based on frag sizes

When SKBs are coalesced, we can have SKBs with different
frag sizes. Some with PAGE_SIZE and some not with PAGE_SIZE.
Since recv_skip_hint is always set to the full SKB size,
it can overestimate the amount that should be read using
normal read for coalesced packets.

Change the recv_skip_hint so that it only includes the first
frags that are not of PAGE_SIZE.
Signed-off-by: NSoheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8f2b0293
...@@ -1805,8 +1805,17 @@ static int tcp_zerocopy_receive(struct sock *sk, ...@@ -1805,8 +1805,17 @@ static int tcp_zerocopy_receive(struct sock *sk,
frags++; frags++;
} }
} }
if (frags->size != PAGE_SIZE || frags->page_offset) if (frags->size != PAGE_SIZE || frags->page_offset) {
int remaining = zc->recv_skip_hint;
while (remaining && (frags->size != PAGE_SIZE ||
frags->page_offset)) {
remaining -= frags->size;
frags++;
}
zc->recv_skip_hint -= remaining;
break; break;
}
ret = vm_insert_page(vma, address + length, ret = vm_insert_page(vma, address + length,
skb_frag_page(frags)); skb_frag_page(frags));
if (ret) if (ret)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册