• Arjun Roy's avatar
    tcp-zerocopy: Return sk_err (if set) along with tcp receive zerocopy. · 33946518
    Arjun Roy authored
    This patchset is intended to reduce the number of extra system calls
    imposed by TCP receive zerocopy. For ping-pong RPC style workloads,
    this patchset has demonstrated a system call reduction of about 30%
    when coupled with userspace changes.
    
    For applications using epoll, returning sk_err along with the result
    of tcp receive zerocopy could remove the need to call
    recvmsg()=-EAGAIN after a spurious wakeup.
    
    Consider a multi-threaded application using epoll. A thread may awaken
    with EPOLLIN but another thread may already be reading. The
    spuriously-awoken thread does not necessarily know that another thread
    'won'; rather, it may be possible that it was woken up due to the
    presence of an error if there is no data. A zerocopy read receiving 0
    bytes thus would need to be followed up by recvmsg to be sure.
    
    Instead, we return sk_err directly with zerocopy, so the application
    can avoid this extra system call.
    Signed-off-by: default avatarArjun Roy <arjunroy@google.com>
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    33946518
tcp.c 106 KB