提交 6836b9bd 编写于 作者: J jamal 提交者: David S. Miller

xfrm: avoid spinlock in get_acqseq() used by xfrm user

Eric's version fixed it for pfkey. This one is for xfrm user.
I thought about amortizing those two get_acqseq()s but it seems
reasonable to have two of these sequence spaces for the two different
interfaces.

cheers,
jamal
commit d5168d5addbc999c94aacda8f28a4a173756a72b
Author: Jamal Hadi Salim <hadi@cyberus.ca>
Date:   Tue Feb 16 06:51:22 2010 -0500

    xfrm: avoid spinlock in get_acqseq() used by xfrm user

    This is in the same spirit as commit 28aecb9d
    by Eric Dumazet.
    Use atomic_inc_return() in get_acqseq() to avoid taking a spinlock
Signed-off-by: NJamal Hadi Salim <hadi@cyberus.ca>
Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e06d41d0
...@@ -1462,12 +1462,12 @@ EXPORT_SYMBOL(xfrm_find_acq_byseq); ...@@ -1462,12 +1462,12 @@ EXPORT_SYMBOL(xfrm_find_acq_byseq);
u32 xfrm_get_acqseq(void) u32 xfrm_get_acqseq(void)
{ {
u32 res; u32 res;
static u32 acqseq; static atomic_t acqseq;
static DEFINE_SPINLOCK(acqseq_lock);
do {
res = atomic_inc_return(&acqseq);
} while (!res);
spin_lock_bh(&acqseq_lock);
res = (++acqseq ? : ++acqseq);
spin_unlock_bh(&acqseq_lock);
return res; return res;
} }
EXPORT_SYMBOL(xfrm_get_acqseq); EXPORT_SYMBOL(xfrm_get_acqseq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册