]> git.hungrycats.org Git - linux/commit
af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
authorEric Dumazet <edumazet@google.com>
Wed, 15 May 2024 16:33:58 +0000 (16:33 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2024 07:49:51 +0000 (09:49 +0200)
commit14cb0783deaa7757c63dd47bdb55a57b0c901d42
tree9d4a343750b26e5f0d406e5b031dd5b96609439f
parent5fb7e2a4335fc67d6952ad2a6613c46e0b05f7c5
af_packet: do not call packet_read_pending() from tpacket_destruct_skb()

[ Upstream commit 581073f626e387d3e7eed55c48c8495584ead7ba ]

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
b013840810c2 ("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: 89ed5b519004 ("af_packet: Block execution of tasks waiting for transmit to complete in AF_PACKET")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20240515163358.4105915-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/packet/af_packet.c