af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
Subsystems (3)
PATCH 1/1 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 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.
--- net/packet/af_packet.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/packet/af_packet.c +1 -2
@@ -2522,8 +2522,7 @@ static void tpacket_destruct_skb(struct sk_buff *skb) ts =__packet_set_timestamp (po, ph, skb);__packet_set_status (po, ph,TP_STATUS_AVAILABLE | ts); -if (!packet_read_pending (&po->tx_ring)) -complete (&po->skb_completion); +complete (&po->skb_completion); }sock_wfree (skb);
Signature · 1 line
2.45.0.rc1.225.g2a3ae87e7f-goog
Quoted 7 lines · Eric Dumazet
trafgen performance considerably sank on hosts with many cores after the blamed commit.
packet_read_pending()is very expensive, and calling it inaf_packetfast path defeats Daniel intent in commitb013840810c2("packet: use percpu mmap tx frame pending refcount")
Quoted 8 lines
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 <[email protected]>Cc Neil Horman <[email protected]>Cc Daniel Borkmann <[email protected]>Cc Willem de Bruijn <[email protected]>
Thanks!
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 15 May 2024 16:33:58 +0000 you wrote:
trafgen performance considerably sank on hosts with many cores after the blamed commit.
packet_read_pending()is very expensive, and calling it inaf_packetfast path defeats Daniel intent in commitb013840810c2("packet: use percpu mmap tx frame pending refcount")[...]
Here is the summary with links:
- [net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
https://git.kernel.org/netdev/net/c/581073f626e3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 7 lines · Eric Dumazet
trafgen performance considerably sank on hosts with many cores after the blamed commit.
packet_read_pending()is very expensive, and calling it inaf_packetfast path defeats Daniel intent in commitb013840810c2("packet: use percpu mmap tx frame pending refcount")
Quoted 8 lines
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 <[email protected]>Cc Neil Horman <[email protected]>Cc Daniel Borkmann <[email protected]>Cc Willem de Bruijn <[email protected]>
Thanks Eric!