[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABWKuGUPkMHZj6qsAYmCnc==4pP8vyYK-3TRJ9oG8mk=nJBLAw@mail.gmail.com>
Date: Wed, 24 Mar 2021 19:01:19 +0800
From: Yejune Deng <yejune.deng@...il.com>
To: Leon Romanovsky <leon@...nel.org>
Cc: David Miller <davem@...emloft.net>, yoshfuji@...ux-ipv6.org,
dsahern@...nel.org, Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
yejune@...il.com
Subject: Re: [PATCH 1/2] net: ipv4: route.c: add likely() statements
My reasons are as following: ipv4_confirm_neigh() belongs to
ipv4_dst_ops that family is AF_INET, and ipv4_neigh_lookup() is also
added likely() when rt->rt_gw_family is equal to AF_INET.
On Wed, Mar 24, 2021 at 6:34 PM Leon Romanovsky <leon@...nel.org> wrote:
>
> On Wed, Mar 24, 2021 at 11:09:22AM +0800, Yejune Deng wrote:
> > Add likely() statements in ipv4_confirm_neigh() for 'rt->rt_gw_family
> > == AF_INET'.
>
> Why? Such macros are beneficial in only specific cases, most of the time,
> likely/unlikely is cargo cult.
>
> >
> > Signed-off-by: Yejune Deng <yejune.deng@...il.com>
> > ---
> > net/ipv4/route.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> > index fa68c2612252..5762d9bc671c 100644
> > --- a/net/ipv4/route.c
> > +++ b/net/ipv4/route.c
> > @@ -440,7 +440,7 @@ static void ipv4_confirm_neigh(const struct dst_entry *dst, const void *daddr)
> > struct net_device *dev = dst->dev;
> > const __be32 *pkey = daddr;
> >
> > - if (rt->rt_gw_family == AF_INET) {
> > + if (likely(rt->rt_gw_family == AF_INET)) {
> > pkey = (const __be32 *)&rt->rt_gw4;
> > } else if (rt->rt_gw_family == AF_INET6) {
> > return __ipv6_confirm_neigh_stub(dev, &rt->rt_gw6);
> > --
> > 2.29.0
> >
Powered by blists - more mailing lists