Commit cfb0c0890b200364c0886c0d9f0dc615f8114c43

Authored by Allan Stephens
Committed by David S. Miller
1 parent e91ed0bcdf

[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 <allan.stephens@windriver.com>
Signed-off-by: Per Liden <per.liden@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

... ... @@ -1208,7 +1208,8 @@
1208 1208 atomic_inc(&tipc_queue_size);
1209 1209 skb_queue_tail(&sock->sk->sk_receive_queue, buf);
1210 1210  
1211   - wake_up_interruptible(sock->sk->sk_sleep);
  1211 + if (waitqueue_active(sock->sk->sk_sleep))
  1212 + wake_up_interruptible(sock->sk->sk_sleep);
1212 1213 return TIPC_OK;
1213 1214 }
1214 1215  
... ... @@ -1223,7 +1224,8 @@
1223 1224 {
1224 1225 struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle;
1225 1226  
1226   - wake_up_interruptible(tsock->sk.sk_sleep);
  1227 + if (waitqueue_active(tsock->sk.sk_sleep))
  1228 + wake_up_interruptible(tsock->sk.sk_sleep);
1227 1229 }
1228 1230  
1229 1231 /**