From: Herbert Xu Date: Thu, 4 Jun 2009 04:45:55 +0000 (-0700) Subject: tun: Only wake up writers X-Git-Tag: v3.0~8655^2~239 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c722c625dbe2758d53365c0ed7d401b0e286f2cf;p=platform%2Fkernel%2Flinux-amlogic.git 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 4cda69b..3f0cdc1 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -844,12 +844,12 @@ static void tun_sock_write_space(struct sock *sk) if (!sock_writeable(sk)) return; - if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) - wake_up_interruptible_sync(sk->sk_sleep); - if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags)) return; + if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) + wake_up_interruptible_sync(sk->sk_sleep); + tun = container_of(sk, struct tun_sock, sk)->tun; kill_fasync(&tun->fasync, SIGIO, POLL_OUT); }