From: David Ahern <dsahern@kernel.org>
To: Breno Leitao <leitao@debian.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: kernel-team@meta.com, "open list:L3MDEV" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: Remove likely from l3mdev_master_ifindex_by_index
Date: Tue, 8 Oct 2024 12:25:28 -0600 [thread overview]
Message-ID: <cea1458c-6445-45d0-bfa1-3c093384cc90@kernel.org> (raw)
In-Reply-To: <20241008163205.3939629-1-leitao@debian.org>
On 10/8/24 10:32 AM, Breno Leitao wrote:
> The likely() annotation in l3mdev_master_ifindex_by_index() has been
> found to be incorrect 100% of the time in real-world workloads (e.g.,
> web servers).
>
> Annotated branches shows the following in these servers:
>
> correct incorrect % Function File Line
> 0 169053813 100 l3mdev_master_ifindex_by_index l3mdev.h 81
>
> This is happening because l3mdev_master_ifindex_by_index() is called
> from __inet_check_established(), which calls
> l3mdev_master_ifindex_by_index() passing the socked bounded interface.
>
> l3mdev_master_ifindex_by_index(net, sk->sk_bound_dev_if);
>
> Since most sockets are not going to be bound to a network device,
> the likely() is giving the wrong assumption.
>
> Remove the likely() annotation to ensure more accurate branch
> prediction.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> include/net/l3mdev.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
next prev parent reply other threads:[~2024-10-08 18:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 16:32 Breno Leitao
2024-10-08 18:25 ` David Ahern [this message]
2024-10-09 13:54 ` Eric Dumazet
2024-10-10 10:20 ` patchwork-bot+netdevbpf
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=cea1458c-6445-45d0-bfa1-3c093384cc90@kernel.org \
--to=dsahern@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®