netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] udp: use indirect call wrapper for data ready()
@ 2023-07-18 14:38 Paolo Abeni
  2023-07-18 15:47 ` Willem de Bruijn
  2023-07-20  4:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Abeni @ 2023-07-18 14:38 UTC (permalink / raw)
  To: netdev
  Cc: Willem de Bruijn, David S. Miller, David Ahern, Eric Dumazet,
	Jakub Kicinski

In most cases UDP sockets use the default data ready callback.
Leverage the indirect call wrapper for such callback to avoid an
indirect call in fastpath.

The above gives small but measurable performance gain under UDP flood.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
v1 -> v2:
 - do not introduce the specific helper (Willem)
---
 net/ipv4/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 42a96b3547c9..8c3ebd95f5b9 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1553,7 +1553,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
 	spin_unlock(&list->lock);
 
 	if (!sock_flag(sk, SOCK_DEAD))
-		sk->sk_data_ready(sk);
+		INDIRECT_CALL_1(sk->sk_data_ready, sock_def_readable, sk);
 
 	busylock_release(busy);
 	return 0;
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v2 net-next] udp: use indirect call wrapper for data ready()
  2023-07-18 14:38 [PATCH v2 net-next] udp: use indirect call wrapper for data ready() Paolo Abeni
@ 2023-07-18 15:47 ` Willem de Bruijn
  2023-07-20  4:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2023-07-18 15:47 UTC (permalink / raw)
  To: Paolo Abeni, netdev
  Cc: Willem de Bruijn, David S. Miller, David Ahern, Eric Dumazet,
	Jakub Kicinski

Paolo Abeni wrote:
> In most cases UDP sockets use the default data ready callback.
> Leverage the indirect call wrapper for such callback to avoid an
> indirect call in fastpath.
> 
> The above gives small but measurable performance gain under UDP flood.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>

> ---
> v1 -> v2:
>  - do not introduce the specific helper (Willem)

I was just about to Ack v1. Did not mean to request a respin if
no one else spoke up. But thanks for humoring me :)

> ---
>  net/ipv4/udp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 42a96b3547c9..8c3ebd95f5b9 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -1553,7 +1553,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
>  	spin_unlock(&list->lock);
>  
>  	if (!sock_flag(sk, SOCK_DEAD))
> -		sk->sk_data_ready(sk);
> +		INDIRECT_CALL_1(sk->sk_data_ready, sock_def_readable, sk);
>  
>  	busylock_release(busy);
>  	return 0;
> -- 
> 2.41.0
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] udp: use indirect call wrapper for data ready()
  2023-07-18 14:38 [PATCH v2 net-next] udp: use indirect call wrapper for data ready() Paolo Abeni
  2023-07-18 15:47 ` Willem de Bruijn
@ 2023-07-20  4:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-20  4:20 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: netdev, willemdebruijn.kernel, davem, dsahern, edumazet, kuba

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 18 Jul 2023 16:38:09 +0200 you wrote:
> In most cases UDP sockets use the default data ready callback.
> Leverage the indirect call wrapper for such callback to avoid an
> indirect call in fastpath.
> 
> The above gives small but measurable performance gain under UDP flood.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> 
> [...]

Here is the summary with links:
  - [v2,net-next] udp: use indirect call wrapper for data ready()
    https://git.kernel.org/netdev/net-next/c/0558e1674598

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] 3+ messages in thread

end of thread, other threads:[~2023-07-20  4:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 14:38 [PATCH v2 net-next] udp: use indirect call wrapper for data ready() Paolo Abeni
2023-07-18 15:47 ` Willem de Bruijn
2023-07-20  4:20 ` patchwork-bot+netdevbpf

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).