diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-04-28 13:58:17 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-05-01 14:19:01 +0300 |
commit | 14bfee9b62702ccac3014f1291943fabebafd5bc (patch) | |
tree | b52d5c6ed00ce1113620a4b9c13fed2cc3151be1 /net/core/sock.c | |
parent | 0ed99ecc95b9c1d3c46d3bc34459088e82caef32 (diff) | |
download | linux-14bfee9b62702ccac3014f1291943fabebafd5bc.tar.xz |
sock: dedup sock_def_write_space wmem_alloc checks
Except for minor rounding differences the first ->sk_wmem_alloc test in
sock_def_write_space() is a hand coded version of sock_writeable().
Replace it with the helper, and also kill the following if duplicating
the check.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index b164618f2cb6..6ad22fc2eb81 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3191,15 +3191,14 @@ static void sock_def_write_space(struct sock *sk) /* Do not wake up a writer until he can make "significant" * progress. --DaveM */ - if ((refcount_read(&sk->sk_wmem_alloc) << 1) <= READ_ONCE(sk->sk_sndbuf)) { + if (sock_writeable(sk)) { wq = rcu_dereference(sk->sk_wq); if (skwq_has_sleeper(wq)) wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND); /* Should agree with poll, otherwise some programs break */ - if (sock_writeable(sk)) - sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); + sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); } rcu_read_unlock(); |