mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 05:42:46 +01:00
udp: no longer touch sk->sk_refcnt in early demux
After commitsca065d0cf8("udp: no longer use SLAB_DESTROY_BY_RCU") and7ae215d23c("bpf: Don't refcount LISTEN sockets in sk_assign()") UDP early demux no longer need to grab a refcount on the UDP socket. This save two atomic operations per incoming packet for connected sockets. Signed-off-by: Eric Dumazet <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Joe Stringer <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Willem de Bruijn <[email protected]> Cc: Kuniyuki Iwashima <[email protected]> Acked-by: Paolo Abeni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
1 parent
e996401e06
commit
08842c43d0
2 files changed
+6
-4
No files matched your search
+3
-2
@@ -2568,11 +2568,12 @@ int udp_v4_early_demux(struct sk_buff *skb)
|
||||
uh->source, iph->saddr, dif, sdif);
|
||||
}
|
||||
|
||||
if (!sk || !refcount_inc_not_zero(&sk->sk_refcnt))
|
||||
if (!sk)
|
||||
return 0;
|
||||
|
||||
skb->sk = sk;
|
||||
skb->destructor = sock_efree;
|
||||
DEBUG_NET_WARN_ON_ONCE(sk_is_refcounted(sk));
|
||||
skb->destructor = sock_pfree;
|
||||
dst = rcu_dereference(sk->sk_rx_dst);
|
||||
|
||||
if (dst)
|
||||
|
||||
+3
-2
@@ -1098,11 +1098,12 @@ void udp_v6_early_demux(struct sk_buff *skb)
|
||||
else
|
||||
return;
|
||||
|
||||
if (!sk || !refcount_inc_not_zero(&sk->sk_refcnt))
|
||||
if (!sk)
|
||||
return;
|
||||
|
||||
skb->sk = sk;
|
||||
skb->destructor = sock_efree;
|
||||
DEBUG_NET_WARN_ON_ONCE(sk_is_refcounted(sk));
|
||||
skb->destructor = sock_pfree;
|
||||
dst = rcu_dereference(sk->sk_rx_dst);
|
||||
|
||||
if (dst)
|
||||
|
||||
Reference in new issue
Block a user