diff options
author | Arjun Roy <arjunroy@google.com> | 2020-12-02 14:53:46 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-12-04 13:40:53 -0800 |
commit | 936ced415751f744654f64977ddbf67d17a2a45a (patch) | |
tree | 77b7b5c2672a902ad70db1dfae9fe10f4922657f /net/ipv4 | |
parent | 98917cf0d6eda01e8c3c34d35398d46b247b6fd3 (diff) |
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: Arjun Roy <arjunroy@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index aa1040b5a977..b9e44ad2b40d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -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); |