udp: avoid calling sock_def_readable() if possible
authorEric Dumazet <edumazet@google.com>
Thu, 28 Mar 2024 14:40:31 +0000 (14:40 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 29 Mar 2024 22:03:11 +0000 (15:03 -0700)
commit612b1c0dec5bc7367f90fc508448b8d0d7c05414
tree113a28eef2410940aaedd927578f8fba2ac97720
parent6a1f12dd85a8b24f871dfcf467378660af9c064d
udp: avoid calling sock_def_readable() if possible

sock_def_readable() is quite expensive (particularly
when ep_poll_callback() is in the picture).

We must call sk->sk_data_ready() when :

- receive queue was empty, or
- SO_PEEK_OFF is enabled on the socket, or
- sk->sk_data_ready is not sock_def_readable.

We still need to call sk_wake_async().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/20240328144032.1864988-4-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/udp.c