diff options
author | Alex Shi <alex.shi@intel.com> | 2012-05-14 17:15:31 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-05-14 17:15:31 -0400 |
commit | 19e8d69c543f8f62050099892b138e981db952cc (patch) | |
tree | d528c64fbf333dccedac785eeebed3adccf5a153 /net | |
parent | 9ff00d58a915b6747ba2e843ab2d04c712b4dc32 (diff) |
net: replace percpu_xxx funcs with this_cpu_xxx or __this_cpu_xxx
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>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/xt_TEE.c | 12 | ||||
-rw-r--r-- | 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 4d5057902839..ee2e5bc5a8c7 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) | |||
87 | const struct xt_tee_tginfo *info = par->targinfo; | 87 | const struct xt_tee_tginfo *info = par->targinfo; |
88 | struct iphdr *iph; | 88 | struct iphdr *iph; |
89 | 89 | ||
90 | if (percpu_read(tee_active)) | 90 | if (__this_cpu_read(tee_active)) |
91 | return XT_CONTINUE; | 91 | return XT_CONTINUE; |
92 | /* | 92 | /* |
93 | * Copy the skb, and route the copy. Will later return %XT_CONTINUE for | 93 | * 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) | |||
124 | ip_send_check(iph); | 124 | ip_send_check(iph); |
125 | 125 | ||
126 | if (tee_tg_route4(skb, info)) { | 126 | if (tee_tg_route4(skb, info)) { |
127 | percpu_write(tee_active, true); | 127 | __this_cpu_write(tee_active, true); |
128 | ip_local_out(skb); | 128 | ip_local_out(skb); |
129 | percpu_write(tee_active, false); | 129 | __this_cpu_write(tee_active, false); |
130 | } else { | 130 | } else { |
131 | kfree_skb(skb); | 131 | kfree_skb(skb); |
132 | } | 132 | } |
@@ -168,7 +168,7 @@ tee_tg6(struct sk_buff *skb, const struct xt_action_param *par) | |||
168 | { | 168 | { |
169 | const struct xt_tee_tginfo *info = par->targinfo; | 169 | const struct xt_tee_tginfo *info = par->targinfo; |
170 | 170 | ||
171 | if (percpu_read(tee_active)) | 171 | if (__this_cpu_read(tee_active)) |
172 | return XT_CONTINUE; | 172 | return XT_CONTINUE; |
173 | skb = pskb_copy(skb, GFP_ATOMIC); | 173 | skb = pskb_copy(skb, GFP_ATOMIC); |
174 | if (skb == NULL) | 174 | if (skb == NULL) |
@@ -186,9 +186,9 @@ tee_tg6(struct sk_buff *skb, const struct xt_action_param *par) | |||
186 | --iph->hop_limit; | 186 | --iph->hop_limit; |
187 | } | 187 | } |
188 | if (tee_tg_route6(skb, info)) { | 188 | if (tee_tg_route6(skb, info)) { |
189 | percpu_write(tee_active, true); | 189 | __this_cpu_write(tee_active, true); |
190 | ip6_local_out(skb); | 190 | ip6_local_out(skb); |
191 | percpu_write(tee_active, false); | 191 | __this_cpu_write(tee_active, false); |
192 | } else { | 192 | } else { |
193 | kfree_skb(skb); | 193 | kfree_skb(skb); |
194 | } | 194 | } |
diff --git a/net/socket.c b/net/socket.c index 851edcd6b098..08e873ac1609 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -479,7 +479,7 @@ static struct socket *sock_alloc(void) | |||
479 | inode->i_uid = current_fsuid(); | 479 | inode->i_uid = current_fsuid(); |
480 | inode->i_gid = current_fsgid(); | 480 | inode->i_gid = current_fsgid(); |
481 | 481 | ||
482 | percpu_add(sockets_in_use, 1); | 482 | this_cpu_add(sockets_in_use, 1); |
483 | return sock; | 483 | return sock; |
484 | } | 484 | } |
485 | 485 | ||
@@ -522,7 +522,7 @@ void sock_release(struct socket *sock) | |||
522 | if (rcu_dereference_protected(sock->wq, 1)->fasync_list) | 522 | if (rcu_dereference_protected(sock->wq, 1)->fasync_list) |
523 | printk(KERN_ERR "sock_release: fasync list not empty!\n"); | 523 | printk(KERN_ERR "sock_release: fasync list not empty!\n"); |
524 | 524 | ||
525 | percpu_sub(sockets_in_use, 1); | 525 | this_cpu_sub(sockets_in_use, 1); |
526 | if (!sock->file) { | 526 | if (!sock->file) { |
527 | iput(SOCK_INODE(sock)); | 527 | iput(SOCK_INODE(sock)); |
528 | return; | 528 | return; |