aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-06-04 00:45:55 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-04 00:45:55 -0400
commitc722c625dbe2758d53365c0ed7d401b0e286f2cf (patch)
tree4b73bc0edf80e3b5652c35512fbdb19f472b557a /drivers/net/tun.c
parenta8c617eae4dc2ea9f3d64472233f2d3dc3c9993c (diff)
tun: Only wake up writers
When I added socket accounting to tun I inadvertently introduced spurious wake-up events that kills qemu performance. The problem occurs when qemu polls on the tun fd for read, and then transmits packets. For each packet transmitted, we will wake up qemu even if it only cares about read events. Now this affects all sockets, but it is only a new problem for tun. So this patch tries to fix it for tun first and we can then look at the problem in general. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 4cda69b6b28c..3f0cdc14be82 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -844,12 +844,12 @@ static void tun_sock_write_space(struct sock *sk)
844 if (!sock_writeable(sk)) 844 if (!sock_writeable(sk))
845 return; 845 return;
846 846
847 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
848 wake_up_interruptible_sync(sk->sk_sleep);
849
850 if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags)) 847 if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags))
851 return; 848 return;
852 849
850 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
851 wake_up_interruptible_sync(sk->sk_sleep);
852
853 tun = container_of(sk, struct tun_sock, sk)->tun; 853 tun = container_of(sk, struct tun_sock, sk)->tun;
854 kill_fasync(&tun->fasync, SIGIO, POLL_OUT); 854 kill_fasync(&tun->fasync, SIGIO, POLL_OUT);
855} 855}