From patchwork Tue Feb 11 14:25:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qinchuanyu X-Patchwork-Id: 3627481 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 13B8E9F2F6 for ; Tue, 11 Feb 2014 14:25:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98392201F4 for ; Tue, 11 Feb 2014 14:25:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A760201EF for ; Tue, 11 Feb 2014 14:25:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626AbaBKOZm (ORCPT ); Tue, 11 Feb 2014 09:25:42 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:3534 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750984AbaBKOZm (ORCPT ); Tue, 11 Feb 2014 09:25:42 -0500 Received: from 172.24.2.119 (EHLO szxeml205-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BRE87978; Tue, 11 Feb 2014 22:25:18 +0800 (CST) Received: from SZXEML415-HUB.china.huawei.com (10.82.67.154) by szxeml205-edg.china.huawei.com (172.24.2.58) with Microsoft SMTP Server (TLS) id 14.3.158.1; Tue, 11 Feb 2014 22:25:16 +0800 Received: from [127.0.0.1] (10.177.21.101) by szxeml415-hub.china.huawei.com (10.82.67.154) with Microsoft SMTP Server id 14.3.158.1; Tue, 11 Feb 2014 22:25:13 +0800 Message-ID: <52FA32C5.9040601@huawei.com> Date: Tue, 11 Feb 2014 22:25:09 +0800 From: Qin Chuanyu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: CC: , "Michael S. Tsirkin" , "Anthony Liguori" , KVM list , , Eric Dumazet Subject: [PATCH] tun: use netif_receive_skb instead of netif_rx_ni X-Originating-IP: [10.177.21.101] X-CFilter-Loop: Reflected Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP we could xmit directly instead of going through softirq to gain throughput and lantency improved. test model: VM-Host-Host just do transmit. with vhost thread and nic interrupt bind cpu1. netperf do throuhput test and qperf do lantency test. Host OS: suse11sp3, Guest OS: suse11sp3 latency result(us): packet_len 64 256 512 1460 old(UDP) 44 47 48 66 new(UDP) 38 41 42 66 old(TCP) 52 55 70 117 new(TCP) 45 48 61 114 throughput result(Gbit/s): packet_len 64 512 1024 1460 old(UDP) 0.42 2.02 3.75 4.68 new(UDP) 0.45 2.14 3.77 5.06 TCP due to the latency, client couldn't send packet big enough to get benefit from TSO of nic, so the result show it will send more packet per sencond but get lower throughput. Eric mentioned that it would has problem with cgroup, but the patch had been sent by Herbert Xu. patch_id f845172531fb7410c7fb7780b1a6e51ee6df7d52 Signed-off-by: Chuanyu Qin --- drivers/net/tun.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) tun->dev->stats.rx_bytes += len; diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 44c4db8..90b4e58 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1184,7 +1184,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, skb_probe_transport_header(skb, 0); rxhash = skb_get_hash(skb); - netif_rx_ni(skb); + rcu_read_lock_bh(); + netif_receive_skb(skb); + rcu_read_unlock_bh(); tun->dev->stats.rx_packets++;