mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
unix: use wq_has_sleeper in unix_dgram_recvmsg
The current unix_dgram_recvmsg does a wake up for every received datagram. This seems wasteful as only SOCK_DGRAM client sockets in an n:1 association with a server socket will ever wait because of the associated condition. The patch below changes the function such that the wake up only happens if wq_has_sleeper indicates that someone actually wants to be notified. Testing with SOCK_SEQPACKET and SOCK_DGRAM socket seems to confirm that this is an improvment. Signed-Off-By: Rainer Weikusat <rweikusat@mobileactivedefense.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
75c4a57ca9
commit
77b75f4d8c
1 changed files with 4 additions and 2 deletions
|
@ -1914,8 +1914,10 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
wake_up_interruptible_sync_poll(&u->peer_wait,
|
if (wq_has_sleeper(&u->peer_wait))
|
||||||
POLLOUT | POLLWRNORM | POLLWRBAND);
|
wake_up_interruptible_sync_poll(&u->peer_wait,
|
||||||
|
POLLOUT | POLLWRNORM |
|
||||||
|
POLLWRBAND);
|
||||||
|
|
||||||
if (msg->msg_name)
|
if (msg->msg_name)
|
||||||
unix_copy_addr(msg, skb->sk);
|
unix_copy_addr(msg, skb->sk);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue