Skip to content

Commit 581073f

Browse files
edumazetkuba-moo
authored andcommitted
af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
trafgen performance considerably sank on hosts with many cores after the blamed commit. packet_read_pending() is very expensive, and calling it in af_packet fast path defeats Daniel intent in commit b013840 ("packet: use percpu mmap tx frame pending refcount") tpacket_destruct_skb() makes room for one packet, we can immediately wakeup a producer, no need to completely drain the tx ring. Fixes: 89ed5b5 ("af_packet: Block execution of tasks waiting for transmit to complete in AF_PACKET") Signed-off-by: Eric Dumazet <[email protected]> Cc: Neil Horman <[email protected]> Cc: Daniel Borkmann <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent fa033de commit 581073f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/packet/af_packet.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,8 +2522,7 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
25222522
ts = __packet_set_timestamp(po, ph, skb);
25232523
__packet_set_status(po, ph, TP_STATUS_AVAILABLE | ts);
25242524

2525-
if (!packet_read_pending(&po->tx_ring))
2526-
complete(&po->skb_completion);
2525+
complete(&po->skb_completion);
25272526
}
25282527

25292528
sock_wfree(skb);

0 commit comments

Comments
 (0)