[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLH=Y0GuZz3b2p5d7MtEcPFt62+Z4LBbdiRDtE157ER1w@mail.gmail.com>
Date: Wed, 9 Oct 2024 15:54:56 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: David Ahern <dsahern@...nel.org>
Cc: Breno Leitao <leitao@...ian.org>, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, kernel-team@...a.com,
"open list:L3MDEV" <netdev@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net: Remove likely from l3mdev_master_ifindex_by_index
On Tue, Oct 8, 2024 at 8:25 PM David Ahern <dsahern@...nel.org> wrote:
>
> 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@...ian.org>
> > ---
> > include/net/l3mdev.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
>
> Reviewed-by: David Ahern <dsahern@...nel.org>
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists