Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1278405 > unrolled thread
| Started by | Rainer Weikusat <rweikusat@mobileactivedefense.com> |
|---|---|
| First post | 2015-11-26 20:30 +0100 |
| Last post | 2015-11-26 20:30 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH] unix: use wq_has_sleeper in unix_dgram_recvmsg Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-11-26 20:30 +0100
| From | Rainer Weikusat <rweikusat@mobileactivedefense.com> |
|---|---|
| Date | 2015-11-26 20:30 +0100 |
| Subject | [PATCH] unix: use wq_has_sleeper in unix_dgram_recvmsg |
| Message-ID | <qzaoV-WL-3@gated-at.bofh.it> |
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> --- diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 4e95bdf..7aba73e 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2057,8 +2057,10 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, goto out_unlock; } - wake_up_interruptible_sync_poll(&u->peer_wait, - POLLOUT | POLLWRNORM | POLLWRBAND); + if (wq_has_sleeper(&u->peer_wq)) + wake_up_interruptible_sync_poll(&u->peer_wait, + POLLOUT | POLLWRNORM | + POLLWRBAND); if (msg->msg_name) unix_copy_addr(msg, skb->sk); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web