From patchwork Tue Sep 28 09:05:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 65943 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DA60FB70D2 for ; Tue, 28 Sep 2010 19:06:03 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759611Ab0I1JF7 (ORCPT ); Tue, 28 Sep 2010 05:05:59 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:59363 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758515Ab0I1JF6 (ORCPT ); Tue, 28 Sep 2010 05:05:58 -0400 Received: by fxm3 with SMTP id 3so2441860fxm.19 for ; Tue, 28 Sep 2010 02:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=1LYI93QJDfagkj7XnxhM+5kPF/ZTVbj8dJwgbTGwx3g=; b=L45X2q8wQhALzrCdr8uQ1CUxIMivFocHTnUt/lM29w8+2Dt0ZzRpx4xq5Aj2pFmOKN +zQe3xGuaCT2JzA2e5ut8+kn/J0A8ii12yNlw2Vhv+sAH3z1/73973BGPvNEkfkyIExS QteyV2inIOiIDCpHd5m2Mv46O7BFoW2n3qm2s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=yCCW8c5nh2ANjVTV2cv2yI32Q0dADN7HZkLUIsD+5h2hdXD4ZzPH+AbNFGBfjlZSI0 AUrHIJWhbhF1QOc5JM8AH9EVeQ3YoA/lTV2Ox/02TyjNbKMP1kBtGQNWoO0bwrmv4BZj mCY3WrdDK/yESi4jBBzEOmm5X0FireVrNGCco= Received: by 10.223.13.196 with SMTP id d4mr3350580faa.102.1285664757235; Tue, 28 Sep 2010 02:05:57 -0700 (PDT) Received: from [10.150.51.212] (gw0.net.jmsp.net [212.23.165.14]) by mx.google.com with ESMTPS id r10sm2952290faq.5.2010.09.28.02.05.50 (version=SSLv3 cipher=RC4-MD5); Tue, 28 Sep 2010 02:05:51 -0700 (PDT) Subject: [PATCH net-next-2.6] ip_gre: lockless xmit From: Eric Dumazet To: David Miller Cc: netdev Date: Tue, 28 Sep 2010 11:05:47 +0200 Message-ID: <1285664747.2607.48.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org GRE tunnels can benefit from lockless xmits, using NETIF_F_LLTX Note: If tunnels are created with the "oseq" option, LLTX is not enabled : Even using an atomic_t o_seq, we would increase chance for packets being out of order at receiver. Bench on a 16 cpus machine (dual E5540 cpus), 16 threads sending 10000000 UDP frames via one gre tunnel (size:200 bytes per frame) Before patch : real 3m0.094s user 0m9.365s sys 47m50.103s After patch: real 0m29.756s user 0m11.097s sys 7m33.012s Last problem to solve is the contention on dst : 38660.00 21.4% __ip_route_output_key vmlinux 20786.00 11.5% dst_release vmlinux 14191.00 7.8% __xfrm_lookup vmlinux 12410.00 6.9% ip_finish_output vmlinux 4540.00 2.5% ip_push_pending_frames vmlinux 4427.00 2.4% ip_append_data vmlinux 4265.00 2.4% __alloc_skb vmlinux 4140.00 2.3% __ip_local_out vmlinux 3991.00 2.2% dev_queue_xmit vmlinux Signed-off-by: Eric Dumazet --- net/ipv4/ip_gre.c | 4 ++++ 1 files changed, 4 insertions(+) -- 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/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index a1b5d5e..035db63 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -1557,6 +1557,10 @@ static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nla if (!tb[IFLA_MTU]) dev->mtu = mtu; + /* Can use a lockless transmit, unless we generate output sequences */ + if (!(nt->parms.o_flags & GRE_SEQ)) + dev->features |= NETIF_F_LLTX; + err = register_netdevice(dev); if (err) goto out;