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>
This commit is contained in:
Родитель
0ed99ecc95
Коммит
14bfee9b62
|
@ -3191,14 +3191,13 @@ static void sock_def_write_space(struct sock *sk)
|
||||||
/* Do not wake up a writer until he can make "significant"
|
/* Do not wake up a writer until he can make "significant"
|
||||||
* progress. --DaveM
|
* 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);
|
wq = rcu_dereference(sk->sk_wq);
|
||||||
if (skwq_has_sleeper(wq))
|
if (skwq_has_sleeper(wq))
|
||||||
wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT |
|
wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT |
|
||||||
EPOLLWRNORM | EPOLLWRBAND);
|
EPOLLWRNORM | EPOLLWRBAND);
|
||||||
|
|
||||||
/* Should agree with poll, otherwise some programs break */
|
/* 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче