From: Alex Shi <alex.shi@intel.com>
To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
tj@kernel.org, cl@linux-foundation.org, tony.luck@intel.com,
bp@amd64.org, davem@davemloft.net
Cc: akpm@linux-foundation.org, ebiederm@xmission.com,
sfr@canb.auug.org.au, alex.shi@intel.com, luto@mit.edu,
glommer@parallels.com, fernando@oss.ntt.co.jp, vapier@gentoo.org,
eric.dumazet@gmail.com, dzickus@redhat.com, dhowells@redhat.com,
cbouatmailru@gmail.com, fenghua.yu@intel.com, jkosina@suse.cz,
ext-phil.2.carmody@nokia.com, dan.carpenter@oracle.com,
len.brown@intel.com, fweisbec@gmail.com,
paulmck@linux.vnet.ibm.com, josh@joshtriplett.org,
anton@samba.org, kamezawa.hiroyu@jp.fujitsu.com,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] net: replace percpu_xxx funcs with this_cpu_xxx or __this_cpu_xxx
Date: Fri, 11 May 2012 16:00:13 +0800 [thread overview]
Message-ID: <1336723215-16660-2-git-send-email-alex.shi@intel.com> (raw)
In-Reply-To: <1336723215-16660-1-git-send-email-alex.shi@intel.com>
percpu_xxx funcs are duplicated with this_cpu_xxx funcs, so replace
them for further code clean up.
And in preempt safe scenario, __this_cpu_xxx funcs may has a bit
better performance since __this_cpu_xxx has no redundant
preempt_enable/preempt_disable on some architectures.
Signed-off-by: Alex Shi <alex.shi@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
net/netfilter/xt_TEE.c | 12 ++++++------
net/socket.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 4d50579..ee2e5bc 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -87,7 +87,7 @@ tee_tg4(struct sk_buff *skb, const struct xt_action_param *par)
const struct xt_tee_tginfo *info = par->targinfo;
struct iphdr *iph;
- if (percpu_read(tee_active))
+ if (__this_cpu_read(tee_active))
return XT_CONTINUE;
/*
* Copy the skb, and route the copy. Will later return %XT_CONTINUE for
@@ -124,9 +124,9 @@ tee_tg4(struct sk_buff *skb, const struct xt_action_param *par)
ip_send_check(iph);
if (tee_tg_route4(skb, info)) {
- percpu_write(tee_active, true);
+ __this_cpu_write(tee_active, true);
ip_local_out(skb);
- percpu_write(tee_active, false);
+ __this_cpu_write(tee_active, false);
} else {
kfree_skb(skb);
}
@@ -168,7 +168,7 @@ tee_tg6(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct xt_tee_tginfo *info = par->targinfo;
- if (percpu_read(tee_active))
+ if (__this_cpu_read(tee_active))
return XT_CONTINUE;
skb = pskb_copy(skb, GFP_ATOMIC);
if (skb == NULL)
@@ -186,9 +186,9 @@ tee_tg6(struct sk_buff *skb, const struct xt_action_param *par)
--iph->hop_limit;
}
if (tee_tg_route6(skb, info)) {
- percpu_write(tee_active, true);
+ __this_cpu_write(tee_active, true);
ip6_local_out(skb);
- percpu_write(tee_active, false);
+ __this_cpu_write(tee_active, false);
} else {
kfree_skb(skb);
}
diff --git a/net/socket.c b/net/socket.c
index 851edcd..08e873a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -479,7 +479,7 @@ static struct socket *sock_alloc(void)
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- percpu_add(sockets_in_use, 1);
+ this_cpu_add(sockets_in_use, 1);
return sock;
}
@@ -522,7 +522,7 @@ void sock_release(struct socket *sock)
if (rcu_dereference_protected(sock->wq, 1)->fasync_list)
printk(KERN_ERR "sock_release: fasync list not empty!\n");
- percpu_sub(sockets_in_use, 1);
+ this_cpu_sub(sockets_in_use, 1);
if (!sock->file) {
iput(SOCK_INODE(sock));
return;
--
1.7.5.4
next prev parent reply other threads:[~2012-05-11 8:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-11 8:00 [PATCH 0/3] replace percpu_ops function with this_cpu_ops Alex Shi
2012-05-11 8:00 ` Alex Shi [this message]
2012-05-11 8:00 ` [PATCH 2/3] x86: replace percpu_xxx funcs with this_cpu_xxx Alex Shi
2012-05-11 8:17 ` Alex Shi
2012-05-11 8:00 ` [PATCH 3/3] percpu: remove percpu_xxx() functions Alex Shi
2012-05-14 17:34 ` [PATCH 0/3] replace percpu_ops function with this_cpu_ops Tejun Heo
2012-05-14 17:37 ` H. Peter Anvin
2012-05-14 18:01 ` Tejun Heo
2012-05-14 20:57 ` David Miller
2012-05-14 21:17 ` Tejun Heo
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=1336723215-16660-2-git-send-email-alex.shi@intel.com \
--to=alex.shi@intel.com \
--cc=akpm@linux-foundation.org \
--cc=anton@samba.org \
--cc=bp@amd64.org \
--cc=cbouatmailru@gmail.com \
--cc=cl@linux-foundation.org \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=dzickus@redhat.com \
--cc=ebiederm@xmission.com \
--cc=eric.dumazet@gmail.com \
--cc=ext-phil.2.carmody@nokia.com \
--cc=fenghua.yu@intel.com \
--cc=fernando@oss.ntt.co.jp \
--cc=fweisbec@gmail.com \
--cc=glommer@parallels.com \
--cc=hpa@zytor.com \
--cc=jkosina@suse.cz \
--cc=josh@joshtriplett.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@mit.edu \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=tony.luck@intel.com \
--cc=vapier@gentoo.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
Powered by JetHome