lkml.org 
[lkml]   [2012]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH v2 3/9] net: xfrm: use __this_cpu_read per-cpu helper
From: Shan Wei <davidshan@tencent.com>


Signed-off-by: Shan Wei <davidshan@tencent.com>
---
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..394d672 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_read(tfms);

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


\
 
 \ /
  Last update: 2012-11-02 17:21    [W:1.509 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site