提交 936ced41 编写于 作者: A Arjun Roy 提交者: Jakub Kicinski

net-zerocopy: Fast return if inq < PAGE_SIZE

Sometimes, we may call tcp receive zerocopy when inq is 0,
or inq < PAGE_SIZE, in which case we cannot remap pages. In this case,
simply return the appropriate hint for regular copying without taking
mmap_sem.
Signed-off-by: NArjun Roy <arjunroy@google.com>
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NSoheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 98917cf0
......@@ -1904,6 +1904,14 @@ static int tcp_zerocopy_receive(struct sock *sk,
sock_rps_record_flow(sk);
if (inq < PAGE_SIZE) {
zc->length = 0;
zc->recv_skip_hint = inq;
if (!inq && sock_flag(sk, SOCK_DONE))
return -EIO;
return 0;
}
mmap_read_lock(current->mm);
vma = find_vma(current->mm, address);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册