diff options
author | Eric Dumazet <edumazet@google.com> | 2024-01-18 20:17:49 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-01-21 18:09:30 +0000 |
commit | a54d51fb2dfb846aedf3751af501e9688db447f5 (patch) | |
tree | a7caec9bea91b6523352babace79103a93c5b514 /include/net/inet_sock.h | |
parent | e3f9bed9bee261e3347131764e42aeedf1ffea61 (diff) | |
download | linux-stable-a54d51fb2dfb846aedf3751af501e9688db447f5.tar.gz linux-stable-a54d51fb2dfb846aedf3751af501e9688db447f5.tar.bz2 linux-stable-a54d51fb2dfb846aedf3751af501e9688db447f5.zip |
udp: fix busy polling
Generic sk_busy_loop_end() only looks at sk->sk_receive_queue
for presence of packets.
Problem is that for UDP sockets after blamed commit, some packets
could be present in another queue: udp_sk(sk)->reader_queue
In some cases, a busy poller could spin until timeout expiration,
even if some packets are available in udp_sk(sk)->reader_queue.
v3: - make sk_busy_loop_end() nicer (Willem)
v2: - add a READ_ONCE(sk->sk_family) in sk_is_inet() to avoid KCSAN splats.
- add a sk_is_inet() check in sk_is_udp() (Willem feedback)
- add a sk_is_inet() check in sk_is_tcp().
Fixes: 2276f58ac589 ("udp: use a separate rx queue for packet reception")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r-- | include/net/inet_sock.h | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index aa86453f6b9b..d94c242eb3ed 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -307,11 +307,6 @@ static inline unsigned long inet_cmsg_flags(const struct inet_sock *inet) #define inet_assign_bit(nr, sk, val) \ assign_bit(INET_FLAGS_##nr, &inet_sk(sk)->inet_flags, val) -static inline bool sk_is_inet(struct sock *sk) -{ - return sk->sk_family == AF_INET || sk->sk_family == AF_INET6; -} - /** * sk_to_full_sk - Access to a full socket * @sk: pointer to a socket |