linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Yejune Deng <yejune.deng@gmail.com>
Cc: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org,
	kuba@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, yejune@gmail.com
Subject: Re: [PATCH 1/2] net: ipv4: route.c: add likely() statements
Date: Wed, 24 Mar 2021 12:34:52 +0200	[thread overview]
Message-ID: <YFsVzP6P9l0aaIVo@unreal> (raw)
In-Reply-To: <20210324030923.17203-1-yejune.deng@gmail.com>

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@gmail.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
> 

  reply	other threads:[~2021-03-24 10:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24  3:09 [PATCH 1/2] net: ipv4: route.c: add likely() statements Yejune Deng
2021-03-24 10:34 ` Leon Romanovsky [this message]
2021-03-24 11:01   ` Yejune Deng
2021-03-24 12:19     ` Leon Romanovsky

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=YFsVzP6P9l0aaIVo@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yejune.deng@gmail.com \
    --cc=yejune@gmail.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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).