* [PATCH net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
@ 2024-05-15 16:33 Eric Dumazet
2024-05-15 18:02 ` Willem de Bruijn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2024-05-15 16:33 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: netdev, eric.dumazet, Eric Dumazet, Neil Horman, Daniel Borkmann,
Willem de Bruijn
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>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
---
net/packet/af_packet.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 8c6d3fbb4ed87f17c2e365810106a05fe9b8ff0c..ea3ebc160e25cc661901717a755f47db927c304d 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -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);
--
2.45.0.rc1.225.g2a3ae87e7f-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
2024-05-15 16:33 [PATCH net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb() Eric Dumazet
@ 2024-05-15 18:02 ` Willem de Bruijn
2024-05-17 2:40 ` patchwork-bot+netdevbpf
2024-05-21 9:34 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Willem de Bruijn @ 2024-05-15 18:02 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: netdev, eric.dumazet, Eric Dumazet, Neil Horman, Daniel Borkmann,
Willem de Bruijn
Eric Dumazet wrote:
> 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>
> Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
2024-05-15 16:33 [PATCH net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb() Eric Dumazet
2024-05-15 18:02 ` Willem de Bruijn
@ 2024-05-17 2:40 ` patchwork-bot+netdevbpf
2024-05-21 9:34 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-17 2:40 UTC (permalink / raw)
To: Eric Dumazet
Cc: davem, kuba, pabeni, netdev, eric.dumazet, nhorman, daniel,
willemdebruijn.kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
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
> in af_packet fast path defeats Daniel intent in commit
> b013840810c2 ("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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
2024-05-15 16:33 [PATCH net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb() Eric Dumazet
2024-05-15 18:02 ` Willem de Bruijn
2024-05-17 2:40 ` patchwork-bot+netdevbpf
@ 2024-05-21 9:34 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2024-05-21 9:34 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: netdev, eric.dumazet, Neil Horman, Willem de Bruijn
On 5/15/24 6:33 PM, Eric Dumazet wrote:
> 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>
> Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Thanks Eric!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-21 9:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 16:33 [PATCH net] af_packet: do not call packet_read_pending() from tpacket_destruct_skb() Eric Dumazet
2024-05-15 18:02 ` Willem de Bruijn
2024-05-17 2:40 ` patchwork-bot+netdevbpf
2024-05-21 9:34 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).