aboutsummaryrefslogtreecommitdiffstats
path: root/net/key/af_key.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-01-28 23:05:52 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-02 18:55:41 -0500
commit28aecb9d7728dc26bf03ce7925fe622023a83a2a (patch)
treeb5adad3e5ba77bb00e13a81eea5823bc0d76fb82 /net/key/af_key.c
parentd1c9ae6d1e7b95cedc8e39e8949e795379a0669e (diff)
xfrm: avoid spinlock in get_acqseq()
Use atomic_inc_return() in get_acqseq() to avoid taking a spinlock Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/key/af_key.c')
-rw-r--r--net/key/af_key.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 4744b1f6372f..e2aacf0ba013 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3019,12 +3019,11 @@ static int pfkey_send_policy_notify(struct xfrm_policy *xp, int dir, struct km_e
3019static u32 get_acqseq(void) 3019static u32 get_acqseq(void)
3020{ 3020{
3021 u32 res; 3021 u32 res;
3022 static u32 acqseq; 3022 static atomic_t acqseq;
3023 static DEFINE_SPINLOCK(acqseq_lock);
3024 3023
3025 spin_lock_bh(&acqseq_lock); 3024 do {
3026 res = (++acqseq ? : ++acqseq); 3025 res = atomic_inc_return(&acqseq);
3027 spin_unlock_bh(&acqseq_lock); 3026 } while (!res);
3028 return res; 3027 return res;
3029} 3028}
3030 3029