From patchwork Fri Nov 9 02:21:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: solomon X-Patchwork-Id: 197915 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 AD8BA2C008F for ; Fri, 9 Nov 2012 13:21:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757527Ab2KICVR (ORCPT ); Thu, 8 Nov 2012 21:21:17 -0500 Received: from mail-pb0-f46.google.com ([209.85.160.46]:57109 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757256Ab2KICVO (ORCPT ); Thu, 8 Nov 2012 21:21:14 -0500 Received: by mail-pb0-f46.google.com with SMTP id rr4so2481634pbb.19 for ; Thu, 08 Nov 2012 18:21:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=/zUOYzqxc33My8yy884ll06+q3GJzOmzOgjZiCvMe2A=; b=r02+RggJW8NWsYVEVHe+mrPmLuSdIoX6u+cd4jzXPG1FIXp+2tDnmXVEwbh7X2Xl7Y glX+8eh4KAeuRIH9+Kqvm5NSdaBrlUjx/bKtuwUgz6AG2oM7Ls+nwIvd/dLAaOHxuFzs e2C8pEqKmvz7HASOi6kgONlhSShxRzXmX/pOVA4Fk2W4hmi9G4nf5uwHpm2B5jwHYoC/ 7zO/rCt3LG33icLeGYYZRHCSTpzsjX7mqByDiTH8gJpmGjwHM8GdK5p1PSQ4ciJkFfss i6IlFOiKhxg/H9OjluYE4jyLPEryhrdAFpBoJjGsuqE9w/ZZahIcHezWSwHj6Jvu0HOV ksXA== Received: by 10.68.225.73 with SMTP id ri9mr5412335pbc.124.1352427674412; Thu, 08 Nov 2012 18:21:14 -0800 (PST) Received: from [172.30.10.127] ([121.14.96.125]) by mx.google.com with ESMTPS id ay5sm17084169pab.1.2012.11.08.18.21.10 (version=SSLv3 cipher=OTHER); Thu, 08 Nov 2012 18:21:13 -0800 (PST) Message-ID: <509C6895.6020300@gmail.com> Date: Fri, 09 Nov 2012 10:21:09 +0800 From: Shan Wei User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: jesse@nicira.com, dev@openvswitch.org, NetDev , Kernel-Maillist , David Miller , cl@linux-foundation.org, Shan Wei Subject: [PATCH v3 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Shan Wei just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id()); Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- no changes vs v2. --- net/openvswitch/datapath.c | 4 ++-- net/openvswitch/vport.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 4c4b62c..77d16a5 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -208,7 +208,7 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb) int error; int key_len; - stats = per_cpu_ptr(dp->stats_percpu, smp_processor_id()); + stats = this_cpu_ptr(dp->stats_percpu); /* Extract flow from 'skb' into 'key'. */ error = ovs_flow_extract(skb, p->port_no, &key, &key_len); @@ -282,7 +282,7 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb, return 0; err: - stats = per_cpu_ptr(dp->stats_percpu, smp_processor_id()); + stats = this_cpu_ptr(dp->stats_percpu); u64_stats_update_begin(&stats->sync); stats->n_lost++; diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 03779e8..70af0be 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -333,8 +333,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb) { struct vport_percpu_stats *stats; - stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id()); - + stats = this_cpu_ptr(vport->percpu_stats); u64_stats_update_begin(&stats->sync); stats->rx_packets++; stats->rx_bytes += skb->len; @@ -359,7 +358,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb) if (likely(sent)) { struct vport_percpu_stats *stats; - stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id()); + stats = this_cpu_ptr(vport->percpu_stats); u64_stats_update_begin(&stats->sync); stats->tx_packets++;