* [PATCH net-next] core: simplify the getting percpu of flow_cache
@ 2013-03-28 12:24 roy.qing.li
2013-03-28 13:15 ` Eric Dumazet
2013-03-29 19:15 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: roy.qing.li @ 2013-03-28 12:24 UTC (permalink / raw)
To: netdev
From: Li RongQing <roy.qing.li@gmail.com>
replace per_cpu with per_cpu_ptr to save conversion between address and pointer
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
net/core/flow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/flow.c b/net/core/flow.c
index 7fae135..707fb7b 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -334,7 +334,7 @@ static int flow_cache_percpu_empty(struct flow_cache *fc, int cpu)
struct flow_cache_percpu *fcp;
int i;
- fcp = &per_cpu(*fc->percpu, cpu);
+ fcp = per_cpu_ptr(fc->percpu, cpu);
for (i = 0; i < flow_cache_hash_size(fc); i++)
if (!hlist_empty(&fcp->hash_table[i]))
return 0;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] core: simplify the getting percpu of flow_cache
2013-03-28 12:24 [PATCH net-next] core: simplify the getting percpu of flow_cache roy.qing.li
@ 2013-03-28 13:15 ` Eric Dumazet
2013-03-29 1:07 ` RongQing Li
2013-03-29 19:15 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2013-03-28 13:15 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev, Christoph Lameter
On Thu, 2013-03-28 at 20:24 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
>
> replace per_cpu with per_cpu_ptr to save conversion between address and pointer
>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
> net/core/flow.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/flow.c b/net/core/flow.c
> index 7fae135..707fb7b 100644
> --- a/net/core/flow.c
> +++ b/net/core/flow.c
> @@ -334,7 +334,7 @@ static int flow_cache_percpu_empty(struct flow_cache *fc, int cpu)
> struct flow_cache_percpu *fcp;
> int i;
>
> - fcp = &per_cpu(*fc->percpu, cpu);
> + fcp = per_cpu_ptr(fc->percpu, cpu);
> for (i = 0; i < flow_cache_hash_size(fc); i++)
> if (!hlist_empty(&fcp->hash_table[i]))
> return 0;
This makes no difference at all, at least on x86
Care to elaborate ?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] core: simplify the getting percpu of flow_cache
2013-03-28 13:15 ` Eric Dumazet
@ 2013-03-29 1:07 ` RongQing Li
0 siblings, 0 replies; 4+ messages in thread
From: RongQing Li @ 2013-03-29 1:07 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, Christoph Lameter
2013/3/28 Eric Dumazet <eric.dumazet@gmail.com>:
> On Thu, 2013-03-28 at 20:24 +0800, roy.qing.li@gmail.com wrote:
>> From: Li RongQing <roy.qing.li@gmail.com>
>>
>> replace per_cpu with per_cpu_ptr to save conversion between address and pointer
>>
>> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
>> ---
>> net/core/flow.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/core/flow.c b/net/core/flow.c
>> index 7fae135..707fb7b 100644
>> --- a/net/core/flow.c
>> +++ b/net/core/flow.c
>> @@ -334,7 +334,7 @@ static int flow_cache_percpu_empty(struct flow_cache *fc, int cpu)
>> struct flow_cache_percpu *fcp;
>> int i;
>>
>> - fcp = &per_cpu(*fc->percpu, cpu);
>> + fcp = per_cpu_ptr(fc->percpu, cpu);
>> for (i = 0; i < flow_cache_hash_size(fc); i++)
>> if (!hlist_empty(&fcp->hash_table[i]))
>> return 0;
>
>
> This makes no difference at all, at least on x86
>
> Care to elaborate ?
>
I think it seems to be same as per_cpu, but it makes the codes easy to read,
by ignore & before per_cpu() and * beore fc->percpu, and other places in flow.c
are using per_cpu_ptr(fc->percpu, cpu)
-Roy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] core: simplify the getting percpu of flow_cache
2013-03-28 12:24 [PATCH net-next] core: simplify the getting percpu of flow_cache roy.qing.li
2013-03-28 13:15 ` Eric Dumazet
@ 2013-03-29 19:15 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2013-03-29 19:15 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev
From: roy.qing.li@gmail.com
Date: Thu, 28 Mar 2013 20:24:11 +0800
> From: Li RongQing <roy.qing.li@gmail.com>
>
> replace per_cpu with per_cpu_ptr to save conversion between address and pointer
>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-29 19:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 12:24 [PATCH net-next] core: simplify the getting percpu of flow_cache roy.qing.li
2013-03-28 13:15 ` Eric Dumazet
2013-03-29 1:07 ` RongQing Li
2013-03-29 19:15 ` David Miller
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).