提交 28aecb9d 编写于 作者: E Eric Dumazet 提交者: David S. Miller

xfrm: avoid spinlock in get_acqseq()

Use atomic_inc_return() in get_acqseq() to avoid taking a spinlock
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d1c9ae6d
无相关合并请求
...@@ -3019,12 +3019,11 @@ static int pfkey_send_policy_notify(struct xfrm_policy *xp, int dir, struct km_e ...@@ -3019,12 +3019,11 @@ static int pfkey_send_policy_notify(struct xfrm_policy *xp, int dir, struct km_e
static u32 get_acqseq(void) static u32 get_acqseq(void)
{ {
u32 res; u32 res;
static u32 acqseq; static atomic_t acqseq;
static DEFINE_SPINLOCK(acqseq_lock);
spin_lock_bh(&acqseq_lock); do {
res = (++acqseq ? : ++acqseq); res = atomic_inc_return(&acqseq);
spin_unlock_bh(&acqseq_lock); } while (!res);
return res; return res;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部