From patchwork Sun Jan 13 23:41:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2699 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=82.221.99.153; helo=diserzione.investici.org; envelope-from=ordex@autistici.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from diserzione.investici.org (diserzione.investici.org [82.221.99.153]) by open-mesh.org (Postfix) with ESMTPS id BA3C8601AFC for ; Mon, 14 Jan 2013 00:42:26 +0100 (CET) Received: from [82.221.99.153] (diserzione [82.221.99.153]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id A09AA180DB8; Sun, 13 Jan 2013 23:42:20 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 diserzione.investici.org A09AA180DB8 From: Antonio Quartulli To: davem@davemloft.net Date: Mon, 14 Jan 2013 09:41:06 +1000 Message-Id: <1358120480-25960-2-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1358120480-25960-1-git-send-email-ordex@autistici.org> References: <1358120480-25960-1-git-send-email-ordex@autistici.org> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Shan Wei , Marek Lindner , Sven Eckelmann Subject: [B.A.T.M.A.N.] [PATCH 01/15] batman-adv: use per_cpu_add helper X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jan 2013 23:42:26 -0000 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 Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/main.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 2f85577..c4fe41f 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -276,9 +276,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)