Re: [PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

2012-01-11 Thread Alex,Shi
On Wed, 2012-01-11 at 01:03 -0800, David Miller wrote:
> From: "Alex,Shi" 
> Date: Wed, 11 Jan 2012 16:45:33 +0800
> 
> >>  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 
> >>  ---
> >>   net/netfilter/xt_TEE.c |   12 ++--
> >>   net/socket.c   |4 ++--
> >>   2 files changed, 8 insertions(+), 8 deletions(-)
> >> >>>
> >> >>> Acked-by: Eric Dumazet 
> >> >>>
> >> >>> Thanks !
> >> >>
> >> >> Anyone like to pick up this patch? or more comments for this? 
> >> > 
> >> > Kaber, David: 
> >> > I appreciate for your any comments on this. Could you like do me a
> >> > favor? 
> >> 
> >> No objections from me.
> > 
> > rend this patch for 3.2.0 kernel with Eric's Ack. 
> > 
> > David, do you have any concerns for this patch?  I will very appreciate
> > if it can met 3.3 open window. 
> 
> Please just submit it directly with the other this_cpu() patches:
> 
> Acked-by: David S. Miller 

Thanks a lot! :) 


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

2012-01-11 Thread David Miller
From: "Alex,Shi" 
Date: Wed, 11 Jan 2012 16:45:33 +0800

>>  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 
>>  ---
>>   net/netfilter/xt_TEE.c |   12 ++--
>>   net/socket.c   |4 ++--
>>   2 files changed, 8 insertions(+), 8 deletions(-)
>> >>>
>> >>> Acked-by: Eric Dumazet 
>> >>>
>> >>> Thanks !
>> >>
>> >> Anyone like to pick up this patch? or more comments for this? 
>> > 
>> > Kaber, David: 
>> > I appreciate for your any comments on this. Could you like do me a
>> > favor? 
>> 
>> No objections from me.
> 
> rend this patch for 3.2.0 kernel with Eric's Ack. 
> 
> David, do you have any concerns for this patch?  I will very appreciate
> if it can met 3.3 open window. 

Please just submit it directly with the other this_cpu() patches:

Acked-by: David S. Miller 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

2012-01-11 Thread Alex,Shi
> >>>> 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 
> >>>> ---
> >>>>  net/netfilter/xt_TEE.c |   12 ++--
> >>>>  net/socket.c   |4 ++--
> >>>>  2 files changed, 8 insertions(+), 8 deletions(-)
> >>>
> >>> Acked-by: Eric Dumazet 
> >>>
> >>> Thanks !
> >>
> >> Anyone like to pick up this patch? or more comments for this? 
> > 
> > Kaber, David: 
> > I appreciate for your any comments on this. Could you like do me a
> > favor? 
> 
> No objections from me.

rend this patch for 3.2.0 kernel with Eric's Ack. 

David, do you have any concerns for this patch?  I will very appreciate
if it can met 3.3 open window. 

-
>From 037bd159fdf52b915e452fac8db2252b1c60297e Mon Sep 17 00:00:00 2001
From: Alex Shi 
Date: Thu, 20 Oct 2011 14:52:17 +0800
Subject: [PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

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 
Acked-by: Eric Dumazet 
---
 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 5f054a0..678084c 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -90,7 +90,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
@@ -127,9 +127,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);
}
@@ -170,7 +170,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)
@@ -188,9 +188,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 ffe92ca..4b62ca9 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.6.3.3

 

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

2011-12-02 Thread Patrick McHardy
On 02.12.2011 03:33, Alex,Shi wrote:
> On Mon, 2011-11-21 at 17:00 +0800, Alex,Shi wrote:
>> On Thu, 2011-10-20 at 16:38 +0800, Eric Dumazet wrote:
>>> Le jeudi 20 octobre 2011 à 15:32 +0800, Alex,Shi a écrit :
 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 
 ---
  net/netfilter/xt_TEE.c |   12 ++--
  net/socket.c   |4 ++--
  2 files changed, 8 insertions(+), 8 deletions(-)
>>>
>>> Acked-by: Eric Dumazet 
>>>
>>> Thanks !
>>
>> Anyone like to pick up this patch? or more comments for this? 
> 
> Kaber, David: 
> I appreciate for your any comments on this. Could you like do me a
> favor? 

No objections from me.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

2011-12-01 Thread Alex,Shi
On Mon, 2011-11-21 at 17:00 +0800, Alex,Shi wrote:
> On Thu, 2011-10-20 at 16:38 +0800, Eric Dumazet wrote:
> > Le jeudi 20 octobre 2011 à 15:32 +0800, Alex,Shi a écrit :
> > > 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 
> > > ---
> > >  net/netfilter/xt_TEE.c |   12 ++--
> > >  net/socket.c   |4 ++--
> > >  2 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > Acked-by: Eric Dumazet 
> > 
> > Thanks !
> 
> Anyone like to pick up this patch? or more comments for this? 

Kaber, David: 
I appreciate for your any comments on this. Could you like do me a
favor? 



--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

2011-11-21 Thread Alex,Shi
On Thu, 2011-10-20 at 16:38 +0800, Eric Dumazet wrote:
> Le jeudi 20 octobre 2011 à 15:32 +0800, Alex,Shi a écrit :
> > 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 
> > ---
> >  net/netfilter/xt_TEE.c |   12 ++--
> >  net/socket.c   |4 ++--
> >  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> Acked-by: Eric Dumazet 
> 
> Thanks !

Anyone like to pick up this patch? or more comments for this? 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

2011-10-20 Thread Eric Dumazet
Le jeudi 20 octobre 2011 à 15:32 +0800, Alex,Shi a écrit :
> 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 
> ---
>  net/netfilter/xt_TEE.c |   12 ++--
>  net/socket.c   |4 ++--
>  2 files changed, 8 insertions(+), 8 deletions(-)

Acked-by: Eric Dumazet 

Thanks !


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] net: use this_cpu_xxx replace percpu_xxx funcs

2011-10-20 Thread Alex,Shi

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 
---
 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 5f054a0..678084c 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -90,7 +90,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
@@ -127,9 +127,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);
}
@@ -170,7 +170,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)
@@ -188,9 +188,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 ffe92ca..4b62ca9 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.6.3.3



--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html