diff mbox series

[v2,net-next] udp: use indirect call wrapper for data ready()

Message ID d47d53e6f8ee7a11228ca2f025d6243cc04b77f3.1689691004.git.pabeni@redhat.com (mailing list archive)
State Accepted
Commit 0558e1674598ec9029c1d3bceb787c8340272b51
Delegated to: Netdev Maintainers
Headers show
Series [v2,net-next] udp: use indirect call wrapper for data ready() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1350 this patch: 1350
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1373 this patch: 1373
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Paolo Abeni July 18, 2023, 2:38 p.m. UTC
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(-)

Comments

Willem de Bruijn July 18, 2023, 3:47 p.m. UTC | #1
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
>
patchwork-bot+netdevbpf@kernel.org July 20, 2023, 4:20 a.m. UTC | #2
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!
diff mbox series

Patch

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;