From: Allan Stephens Date: Tue, 17 Oct 2006 04:47:18 +0000 (-0700) Subject: [TIPC]: Optimize wakeup logic when socket has no waiting processes X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cfb0c0890b200364c0886c0d9f0dc615f8114c43;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [TIPC]: Optimize wakeup logic when socket has no waiting processes This patch adds a simple test so TIPC doesn't try waking up processes waiting on a socket if there are none waiting. Signed-off-by: Allan Stephens Signed-off-by: Per Liden Signed-off-by: David S. Miller --- diff --git a/net/tipc/socket.c b/net/tipc/socket.c index ed900fe96bdf..2a6a5a6b4c12 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1208,7 +1208,8 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) atomic_inc(&tipc_queue_size); skb_queue_tail(&sock->sk->sk_receive_queue, buf); - wake_up_interruptible(sock->sk->sk_sleep); + if (waitqueue_active(sock->sk->sk_sleep)) + wake_up_interruptible(sock->sk->sk_sleep); return TIPC_OK; } @@ -1223,7 +1224,8 @@ static void wakeupdispatch(struct tipc_port *tport) { struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle; - wake_up_interruptible(tsock->sk.sk_sleep); + if (waitqueue_active(tsock->sk.sk_sleep)) + wake_up_interruptible(tsock->sk.sk_sleep); } /**