Message ID | 20090603123655.GA13916@gondor.apana.org.au |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Herbert Xu <herbert@gondor.apana.org.au> Date: Wed, 3 Jun 2009 22:36:55 +1000 > 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> Applied to net-next-2.6, thanks Herbert! -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 735bf41..eeb8af5 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -840,12 +840,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); }