diff options
author | Rainer Weikusat <rweikusat@mobileactivedefense.com> | 2015-11-26 14:23:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-01 14:57:43 -0500 |
commit | 77b75f4d8cf105b599beef38724f8171e557919d (patch) | |
tree | c16747ed0980aa1f8542745a3111bc5ed09f18b1 /net/unix/af_unix.c | |
parent | 75c4a57ca9ee747f1cbb24591d92a41b2eddff52 (diff) |
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>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index efb706e1d1c0..ac011b97097d 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1914,8 +1914,10 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, | |||
1914 | goto out_unlock; | 1914 | goto out_unlock; |
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | wake_up_interruptible_sync_poll(&u->peer_wait, | 1917 | if (wq_has_sleeper(&u->peer_wait)) |
1918 | POLLOUT | POLLWRNORM | POLLWRBAND); | 1918 | wake_up_interruptible_sync_poll(&u->peer_wait, |
1919 | POLLOUT | POLLWRNORM | | ||
1920 | POLLWRBAND); | ||
1919 | 1921 | ||
1920 | if (msg->msg_name) | 1922 | if (msg->msg_name) |
1921 | unix_copy_addr(msg, skb->sk); | 1923 | unix_copy_addr(msg, skb->sk); |