core: simplify the getting percpu of flow_cache
Subsystems (2)
PATCH 1/1 core: simplify the getting percpu of flow_cache
From: Li RongQing <[email protected]>
replace per_cpu with per_cpu_ptr to save conversion between address and pointer
--- net/core/flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/flow.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.10.4
Quoted 14 lines · On Thu, 2013-03-28 at 20:24 +0800, [email protected] wrote:
From: Li RongQing <[email protected]>
replace
per_cpuwithper_cpu_ptrto save conversion between address and pointerSigned-off-by Li RongQing <[email protected]>--- net/core/flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/flow.c +0
-0
net/core/flow.c static int flow_cache_percpu_empty(struct flow_cache *fc, int cpu) · line 340
Quoted 8 lines
net/core/flow.c +1
-1@@ -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 ?
2013/3/28 Eric Dumazet <[email protected]>:
Quoted 27 lines · On Thu, 2013-03-28 at 20:24 +0800, [email protected] wrote:
Quoted 14 lines
From: Li RongQing <[email protected]>
replace
per_cpuwithper_cpu_ptrto save conversion between address and pointerSigned-off-by Li RongQing <[email protected]>--- net/core/flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/flow.c +0
-0net/core/flow.c static int flow_cache_percpu_empty(struct flow_cache *fc, int cpu) · line 340
Quoted 8 lines
net/core/flow.c +1
-1@@ -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
Quoted 2 lines
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
From: [email protected]
Date: Thu, 28 Mar 2013 20:24:11 +0800
Quoted 5 lines
From: Li RongQing <[email protected]>
replace
per_cpuwithper_cpu_ptrto save conversion between address and pointerSigned-off-by Li RongQing <[email protected]>
Applied.