linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Paul Turner <pjt@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/4] indirect call wrappers: helpers to speed-up indirect calls of builtin
Date: Fri, 07 Dec 2018 21:46:37 +0000	[thread overview]
Message-ID: <2c80b9d34540dad337ed2fce6f9d16233105a2c2.camel@infradead.org> (raw)
In-Reply-To: <f692efbbc9df09acb5f18ad16907e28cda520e4d.camel@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]

On Fri, 2018-12-07 at 21:46 +0100, Paolo Abeni wrote:
> > I wonder if we can declare the common case functions as 'weak' so that
> > the link failures don't happen when they're absent.
> 
> I experimented a previous version with alias. I avoided weak alias
> usage, because I [mis?]understood not all compilers have a complete
> support for them (e.g. clang).
> Also, with weak ref, a coding error that is now discovered at build
> time will result in worse performance at runtime, likely with some
> uncommon configuration, possibly not as easily detected. I'm unsure
> that would be better ?!?

I think everything supports weak linkage; we've been using it for
years.

> > Once we extend this past the network code, especially to file systems'
> > f_ops, I suspect we're going to want to use something like static keys
> > to patch the common cases at runtime — perhaps changing the f_ops
> > default according to what the root file system is, etc.
> 
> I'm sorry, I don't follow here. I think static keys can't be used for
> the reported network case: we have different list elements each
> contaning a different function pointer and we access/use
> different ptr on a per packet basis.

Yes, the alternatives would be used to change the "likely" case.

We still do the "if (fn == default_fn) default_fn(); else (*fn)();"
part; or even the variant with two (or more) common cases. 

It's just that the value of 'default_fn' can be changed at runtime
(with patching like alternatives/static keys, since of course it has to
be a direct call).



[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]

  reply	other threads:[~2018-12-07 21:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05 18:13 [PATCH net-next v2 0/4] net: mitigate retpoline overhead Paolo Abeni
2018-12-05 18:13 ` [PATCH net-next v2 1/4] indirect call wrappers: helpers to speed-up indirect calls of builtin Paolo Abeni
2018-12-07  9:46   ` David Woodhouse
2018-12-07 20:46     ` Paolo Abeni
2018-12-07 21:46       ` David Woodhouse [this message]
2018-12-11 22:28         ` Paolo Abeni
2018-12-05 18:13 ` [PATCH net-next v2 2/4] net: use indirect call wrappers at GRO network layer Paolo Abeni
2018-12-05 18:13 ` [PATCH net-next v2 3/4] net: use indirect call wrappers at GRO transport layer Paolo Abeni
2018-12-21  2:57   ` Stephen Hemminger
2018-12-05 18:13 ` [PATCH net-next v2 4/4] udp: use indirect call wrappers for GRO socket lookup Paolo Abeni
2018-12-06  4:49 ` [PATCH net-next v2 0/4] net: mitigate retpoline overhead David Miller
2018-12-07  6:24 ` David Miller
2018-12-07  6:28   ` David Miller
2018-12-07 20:29     ` Paolo Abeni
2018-12-07 21:06       ` David Miller

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=2c80b9d34540dad337ed2fce6f9d16233105a2c2.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pjt@google.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).