summaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-01-29 04:05:52 +0000
committerDavid S. Miller <davem@davemloft.net>2010-02-02 15:55:41 -0800
commit28aecb9d7728dc26bf03ce7925fe622023a83a2a (patch)
treeb5adad3e5ba77bb00e13a81eea5823bc0d76fb82 /net/key
parentd1c9ae6d1e7b95cedc8e39e8949e795379a0669e (diff)
downloadop-kernel-dev-28aecb9d7728dc26bf03ce7925fe622023a83a2a.zip
op-kernel-dev-28aecb9d7728dc26bf03ce7925fe622023a83a2a.tar.gz
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')
-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 4744b1f..e2aacf0 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
static u32 get_acqseq(void)
{
u32 res;
- static u32 acqseq;
- static DEFINE_SPINLOCK(acqseq_lock);
+ static atomic_t acqseq;
- spin_lock_bh(&acqseq_lock);
- res = (++acqseq ? : ++acqseq);
- spin_unlock_bh(&acqseq_lock);
+ do {
+ res = atomic_inc_return(&acqseq);
+ } while (!res);
return res;
}
OpenPOWER on IntegriCloud