Commit 4be73522 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: SOCKWQ_ASYNC_WAITDATA optimizations

SOCKWQ_ASYNC_WAITDATA is set/cleared in sk_wait_data()
and equivalent functions, so that sock_wake_async() can send
a SIGIO only when necessary.

Since these atomic operations are really not needed unless
socket expressed interest in FASYNC, we can omit them in most
cases.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9317bb69
...@@ -1940,7 +1940,8 @@ static inline unsigned long sock_wspace(struct sock *sk) ...@@ -1940,7 +1940,8 @@ static inline unsigned long sock_wspace(struct sock *sk)
*/ */
static inline void sk_set_bit(int nr, struct sock *sk) static inline void sk_set_bit(int nr, struct sock *sk)
{ {
if (nr == SOCKWQ_ASYNC_NOSPACE && !sock_flag(sk, SOCK_FASYNC)) if ((nr == SOCKWQ_ASYNC_NOSPACE || nr == SOCKWQ_ASYNC_WAITDATA) &&
!sock_flag(sk, SOCK_FASYNC))
return; return;
set_bit(nr, &sk->sk_wq_raw->flags); set_bit(nr, &sk->sk_wq_raw->flags);
...@@ -1948,7 +1949,8 @@ static inline void sk_set_bit(int nr, struct sock *sk) ...@@ -1948,7 +1949,8 @@ static inline void sk_set_bit(int nr, struct sock *sk)
static inline void sk_clear_bit(int nr, struct sock *sk) static inline void sk_clear_bit(int nr, struct sock *sk)
{ {
if (nr == SOCKWQ_ASYNC_NOSPACE && !sock_flag(sk, SOCK_FASYNC)) if ((nr == SOCKWQ_ASYNC_NOSPACE || nr == SOCKWQ_ASYNC_WAITDATA) &&
!sock_flag(sk, SOCK_FASYNC))
return; return;
clear_bit(nr, &sk->sk_wq_raw->flags); clear_bit(nr, &sk->sk_wq_raw->flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment