aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-03-06 08:40:18 -0500
committerDavid S. Miller <davem@davemloft.net>2014-03-06 14:46:23 -0500
commitfe8e4649397915cf3b2ab0b695929a27e543967e (patch)
tree383c648ffdef61232e623f723f17247dcb860faf /net/tipc
parent4652edb70e8a7eebbe47fa931940f65522c36e8f (diff)
tipc: avoid to unnecessary process switch under non-block mode
When messages are received via tipc socket under non-block mode, schedule_timeout() is called in tipc_wait_for_rcvmsg(), that is, the process of receiving messages will be scheduled once although timeout value passed to schedule_timeout() is 0. The same issue exists in accept()/wait_for_accept(). To avoid this unnecessary process switch, we only call schedule_timeout() if the timeout value is non-zero. Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index a4cf274455aa..0ed0eaa62f29 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -997,7 +997,7 @@ static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo)
997 997
998 for (;;) { 998 for (;;) {
999 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); 999 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
1000 if (skb_queue_empty(&sk->sk_receive_queue)) { 1000 if (timeo && skb_queue_empty(&sk->sk_receive_queue)) {
1001 if (sock->state == SS_DISCONNECTING) { 1001 if (sock->state == SS_DISCONNECTING) {
1002 err = -ENOTCONN; 1002 err = -ENOTCONN;
1003 break; 1003 break;
@@ -1623,7 +1623,7 @@ static int tipc_wait_for_accept(struct socket *sock, long timeo)
1623 for (;;) { 1623 for (;;) {
1624 prepare_to_wait_exclusive(sk_sleep(sk), &wait, 1624 prepare_to_wait_exclusive(sk_sleep(sk), &wait,
1625 TASK_INTERRUPTIBLE); 1625 TASK_INTERRUPTIBLE);
1626 if (skb_queue_empty(&sk->sk_receive_queue)) { 1626 if (timeo && skb_queue_empty(&sk->sk_receive_queue)) {
1627 release_sock(sk); 1627 release_sock(sk);
1628 timeo = schedule_timeout(timeo); 1628 timeo = schedule_timeout(timeo);
1629 lock_sock(sk); 1629 lock_sock(sk);