[PATCH 3/9] net: xfrm: use this_cpu_ptr per-cpu helper

From: Shan Wei
Date: Wed Oct 31 2012 - 07:22:34 EST


From: Shan Wei <davidshan@xxxxxxxxxxx>


Signed-off-by: Shan Wei <davidshan@xxxxxxxxxxx>
---
net/xfrm/xfrm_ipcomp.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index e5246fb..af6c78a 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -276,14 +276,13 @@ static struct crypto_comp * __percpu *ipcomp_alloc_tfms(const char *alg_name)
struct crypto_comp * __percpu *tfms;
int cpu;

- /* This can be any valid CPU ID so we don't need locking. */
- cpu = raw_smp_processor_id();
-
list_for_each_entry(pos, &ipcomp_tfms_list, list) {
struct crypto_comp *tfm;

tfms = pos->tfms;
- tfm = *per_cpu_ptr(tfms, cpu);
+
+ /* This can be any valid CPU ID so we don't need locking. */
+ tfm = *this_cpu_ptr(tfms);

if (!strcmp(crypto_comp_name(tfm), alg_name)) {
pos->users++;
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/