From: Shan Wei <shanwei88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: lindner_marek-LWAfsSFWpa4@public.gmane.org,
siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org,
ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
NetDev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Kernel-Maillist
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Shan Wei <shanwei88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH v4 9/9] net: batman-adv: use per_cpu_add helper
Date: Tue, 13 Nov 2012 09:53:26 +0800 [thread overview]
Message-ID: <50A1A816.3070900@gmail.com> (raw)
From: Shan Wei <davidshan-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org>
this_cpu_add is an atomic operation.
and be more faster than per_cpu_ptr operation.
Signed-off-by: Shan Wei <davidshan-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org>
Reviewed-by: Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
---
v4: no changes vs v3.
---
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)
--
1.7.1
next reply other threads:[~2012-11-13 1:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 1:53 Shan Wei [this message]
[not found] ` <50A1A816.3070900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-11-13 9:55 ` [PATCH v4 9/9] net: batman-adv: use per_cpu_add helper Marek Lindner
[not found] ` <201211131755.13299.lindner_marek-LWAfsSFWpa4@public.gmane.org>
2012-11-13 10:25 ` Shan Wei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50A1A816.3070900@gmail.com \
--to=shanwei88-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
--cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=lindner_marek-LWAfsSFWpa4@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org \
--cc=siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).