From patchwork Fri Nov 9 02:22:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: solomon X-Patchwork-Id: 197916 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 BA8C92C008F for ; Fri, 9 Nov 2012 13:22:40 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422678Ab2KICW0 (ORCPT ); Thu, 8 Nov 2012 21:22:26 -0500 Received: from mail-pb0-f46.google.com ([209.85.160.46]:53950 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756999Ab2KICWW (ORCPT ); Thu, 8 Nov 2012 21:22:22 -0500 Received: by mail-pb0-f46.google.com with SMTP id rr4so2482197pbb.19 for ; Thu, 08 Nov 2012 18:22:22 -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=Ii9UAwMF+lQJaJCmCauz3Z+2mQ4a6Naiqvd4UuIX94s=; b=WjRcmQ2EyqoDvVdiL9OZCEZr/f027cLB1kdNY/hAoUD7Vukd21QMHbMy3P5yUn1ZUI mAz1dt3s0PEnJEeOEzBIhq5xsCLj5KbI4+KwHbq0JAcwGAQoD5ob1WtxVt2PBz12eZbC obpWx1saz2u8gm/f3DcA/gvWHCvXWPcg0ak5HGSDGC951KY7jSdiKPfKoO7xxaVGFcMP KvalmRRjmh77N1v/YKJmPh7nG8A0gfq9zWMLlNjHdB9upu55HIXtVmHQH2F8ic61s0Qc 5nMQmKi/xWAQuH7azkOVILeNssZPO6H4p6SIFBap8wuDnSYOmclqFdnVRbFPOL3b1tX5 tCbA== Received: by 10.69.1.9 with SMTP id bc9mr29402349pbd.61.1352427741960; Thu, 08 Nov 2012 18:22:21 -0800 (PST) Received: from [172.30.10.127] ([121.14.96.125]) by mx.google.com with ESMTPS id i10sm14728128paz.17.2012.11.08.18.22.16 (version=SSLv3 cipher=OTHER); Thu, 08 Nov 2012 18:22:21 -0800 (PST) Message-ID: <509C68D7.8040603@gmail.com> Date: Fri, 09 Nov 2012 10:22:15 +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: lindner_marek@yahoo.de, siwu@hrz.tu-chemnitz.de, ordex@autistici.org, b.a.t.m.a.n@lists.open-mesh.org, David Miller , NetDev , Kernel-Maillist , Shan Wei , Christoph Lameter Subject: [PATCH v3 9/9] net: batman-adv: use per_cpu_add helper Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Shan Wei this_cpu_add is an atomic operation. and be more faster than per_cpu_ptr operation. Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- v3: change commit message. --- net/batman-adv/main.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 897ba6a..3aef5b2 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -263,9 +263,7 @@ static inline bool batadv_has_timed_out(unsigned long timestamp, static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx, size_t count) { - int cpu = get_cpu(); - per_cpu_ptr(bat_priv->bat_counters, cpu)[idx] += count; - put_cpu(); + this_cpu_add(bat_priv->bat_counters[idx], count); } #define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1)