Skip to content

Commit c2f672f

Browse files
Florian Westphalklassert
authored andcommitted
xfrm: state lookup can be lockless
This is called from the packet input path, we get lock contention if many cpus handle ipsec in parallel. After recent rcu conversion it is safe to call __xfrm_state_lookup without the spinlock. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 34a3d4b commit c2f672f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/xfrm/xfrm_state.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,9 +1431,9 @@ xfrm_state_lookup(struct net *net, u32 mark, const xfrm_address_t *daddr, __be32
14311431
{
14321432
struct xfrm_state *x;
14331433

1434-
spin_lock_bh(&net->xfrm.xfrm_state_lock);
1434+
rcu_read_lock();
14351435
x = __xfrm_state_lookup(net, mark, daddr, spi, proto, family);
1436-
spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1436+
rcu_read_unlock();
14371437
return x;
14381438
}
14391439
EXPORT_SYMBOL(xfrm_state_lookup);

0 commit comments

Comments
 (0)