netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	 netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH net-next] udp: introduce and use indirect call wrapper for data ready()
Date: Mon, 17 Jul 2023 16:13:11 +0200	[thread overview]
Message-ID: <c835b29be1c86d765e9691b1f9772577fa3f560c.camel@redhat.com> (raw)
In-Reply-To: <64b545c1316d2_1e11c1294e3@willemb.c.googlers.com.notmuch>

On Mon, 2023-07-17 at 09:44 -0400, Willem de Bruijn wrote:
> Paolo Abeni wrote:
> > In most cases UDP sockets use the default data ready callback.
> > This patch Introduces and uses a specific indirect call wrapper for
> > such callback to avoid an indirect call in fastpath.
> > 
> > The above gives small but measurable performance gain under UDP flood.
> 
> Interesting. I recently wrote a patch to add indirect call wrappers
> around getfrag (ip_generic_getfrag), expecting that to improve  UDP
> senders. Since it's an indirect call on each send call. Not sent,
> because I did not see measurable gains, at least with a udp_rr bench.
> 
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> > ---
> > Note that this helper could be used for TCP, too. I did not send such
> > patch right away because in my tests the perf delta there is below the
> > noise level even in RR scenarios and the patch would be a little more
> > invasive - there are more sk_data_ready() invocation places.
> > ---
> >  include/net/sock.h | 4 ++++
> >  net/ipv4/udp.c     | 2 +-
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/net/sock.h b/include/net/sock.h
> > index 2eb916d1ff64..1b26dbecdcca 100644
> > --- a/include/net/sock.h
> > +++ b/include/net/sock.h
> > @@ -2947,6 +2947,10 @@ static inline bool sk_dev_equal_l3scope(struct sock *sk, int dif)
> >  }
> >  
> >  void sock_def_readable(struct sock *sk);
> > +static inline void sk_data_ready(struct sock *sk)
> > +{
> > +	INDIRECT_CALL_1(sk->sk_data_ready, sock_def_readable, sk);
> > +}
> > 
> 
> Why introduce a static inline in the header for this?
> 
> To reuse it in other protocols later?

I originally thought about re-using it even for TCP, but showed no gain
there. I think/hope there could be other users, and I found the code
nicer this way ;)

Cheers,

Paolo


  reply	other threads:[~2023-07-17 14:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17  9:52 [PATCH net-next] udp: introduce and use indirect call wrapper for data ready() Paolo Abeni
2023-07-17 13:44 ` Willem de Bruijn
2023-07-17 14:13   ` Paolo Abeni [this message]
2023-07-17 14:47     ` Willem de Bruijn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c835b29be1c86d765e9691b1f9772577fa3f560c.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).