udp: use indirect call wrapper for data ready()
authorPaolo Abeni <pabeni@redhat.com>
Tue, 18 Jul 2023 14:38:09 +0000 (16:38 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 20 Jul 2023 04:12:59 +0000 (21:12 -0700)
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>
Link: https://lore.kernel.org/r/d47d53e6f8ee7a11228ca2f025d6243cc04b77f3.1689691004.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/udp.c

index 42a96b3547c9fadc7d508aff9c57b553cf5fad4d..8c3ebd95f5b98fffe9f6f4dba9443ea220ac2a3a 100644 (file)
@@ -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;