Skip to content

Commit

Permalink
[TIPC]: Optimize wakeup logic when socket has no waiting processes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ajstephens authored and David S. Miller committed Oct 19, 2006
1 parent e91ed0b commit cfb0c08
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
}

/**
Expand Down

0 comments on commit cfb0c08

Please sign in to comment.