Skip to content

Commit 6a1f12d

Browse files
Eric Dumazetkuba-moo
authored andcommitted
udp: relax atomic operation on sk->sk_rmem_alloc
atomic_add_return() is more expensive than atomic_add() and seems overkill in UDP rx fast path. Signed-off-by: Eric Dumazet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6055796 commit 6a1f12d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

net/ipv4/udp.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,12 +1516,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
15161516
size = skb->truesize;
15171517
udp_set_dev_scratch(skb);
15181518

1519-
/* we drop only if the receive buf is full and the receive
1520-
* queue contains some other skb
1521-
*/
1522-
rmem = atomic_add_return(size, &sk->sk_rmem_alloc);
1523-
if (rmem > (size + (unsigned int)sk->sk_rcvbuf))
1524-
goto uncharge_drop;
1519+
atomic_add(size, &sk->sk_rmem_alloc);
15251520

15261521
spin_lock(&list->lock);
15271522
err = udp_rmem_schedule(sk, size);

0 commit comments

Comments
 (0)