From patchwork Thu Dec 9 02:55:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junchang Wang X-Patchwork-Id: 74842 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 30277B70A4 for ; Thu, 9 Dec 2010 14:00:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756778Ab0LIDAs (ORCPT ); Wed, 8 Dec 2010 22:00:48 -0500 Received: from mail-pv0-f174.google.com ([74.125.83.174]:36735 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756721Ab0LIDAs (ORCPT ); Wed, 8 Dec 2010 22:00:48 -0500 Received: by pva4 with SMTP id 4so409422pva.19 for ; Wed, 08 Dec 2010 19:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=D4t1LN/F6Y/qEZCKsOVURQaEtJlBtvuyz433t0wWpBs=; b=AWakdq1ZC9mDwmn0bHjVtIGtbt9N2R0EhI5EB0YnOh57BYCuAjuPELsIl8/UMif0/D LGalnxvVCaiXIjJwmcmSwBMy56xsin3i0GilYsLYuFLwPmUK2l6niBWrx0n3dEPqYhqs psZQ91VtcqvrKwPsDDJLb25x5ukped4NUJfdU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=R4I7l1AxdEh7px+RhbG0elhEy0fZvtnH6TkvsRy0zdJd7CzNagrfhrMLC/kmdUbTfy G1EMZM69NHP+E2N36CgW1FJGTNY2XCVsgrNlqaWn1r0ciWP/qDyAyb0OgjujmAHX5sYX qcHbtVFbIACL0k5C/RwfcQdGUzuRnrhWCCS3g= Received: by 10.142.207.8 with SMTP id e8mr3434681wfg.405.1291863333027; Wed, 08 Dec 2010 18:55:33 -0800 (PST) Received: from Desktop-Junchang ([58.211.218.74]) by mx.google.com with ESMTPS id b11sm1738495wff.21.2010.12.08.18.55.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 08 Dec 2010 18:55:32 -0800 (PST) Date: Thu, 9 Dec 2010 10:55:16 +0800 From: Junchang Wang To: David Miller Cc: eric.dumazet@gmail.com, robert.olsson@its.uu.se, john.r.fastabend@intel.com, andy.shevchenko@gmail.com, netdev@vger.kernel.org, wangjc@mail.ustc.edu.cn Subject: [PATCH net-next-2.6] pktgen: adding prefetchw() call Message-ID: <20101209025511.GC5379@Desktop-Junchang> References: <20101206063349.GA6147@Desktop-Junchang> <20101208.101743.112598404.davem@davemloft.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20101208.101743.112598404.davem@davemloft.net> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Dec 08, 2010 at 10:17:43AM -0800, David Miller wrote: >Your patch was corrupted by your email client, please fix this up >and resubmit. Sorry. I'll avoid this next time. Here's a new version, and I had tested it. Thanks David and Eric. We know for sure pktgen is going to write skb->data right after *_alloc_skb, causing unnecessary cache misses. Idea is to add a prefetchw() call to prefetch the first cache line indicated by skb->data. On systems with Adjacent Cache Line Prefetch, it's probably two cache lines are prefetched. With this patch, pktgen on Intel SR1625 server with two E5530 quad-core processors and a single ixgbe-based NIC went from 8.63Mpps to 9.03Mpps, with 4.6% improvement. Signed-off-by: Junchang Wang Acked-by: Eric Dumazet --- net/core/pktgen.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) -- -- 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/core/pktgen.c b/net/core/pktgen.c index 2953b2a..18fe20d 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2660,6 +2660,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, sprintf(pkt_dev->result, "No memory"); return NULL; } + prefetchw(skb->data); skb_reserve(skb, datalen); @@ -3007,6 +3008,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, sprintf(pkt_dev->result, "No memory"); return NULL; } + prefetchw(skb->data); skb_reserve(skb, 16);