]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: use this_cpu_xxx replace percpu_xxx funcs
authorAlex Shi <alex.shi@intel.com>
Wed, 4 Apr 2012 00:08:07 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 11 Apr 2012 04:45:39 +0000 (14:45 +1000)
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 has a bit better
performance since __this_cpu_xxx has no redundant preempt_disable()

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
net/socket.c

index 4d5057902839888f1fd5afab0c75ebbaab63775b..ee2e5bc5a8c7b506842b6d143fba3f7aa04f3a8d 100644 (file)
@@ -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);
        }
index 851edcd6b0982d5a820da29e2145be75bddcff9c..08e873ac16094ff3307c45b44bf6da5c2a6bb969 100644 (file)
@@ -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;