mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>
Cc: leit@meta.com,
	"open list:NETWORKING [IPv4/IPv6]" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b"
	<llvm@lists.linux.dev>, Wei Wang <weiwan@google.com>
Subject: Re: [PATCH net-next] net/ipv6: resolve warning in ip6_fib.c
Date: Sat, 6 Jan 2024 09:13:53 -0700	[thread overview]
Message-ID: <8ae4f9b0-1917-448d-a89b-11597549f89b@kernel.org> (raw)
In-Reply-To: <20240105173920.1041474-1-leitao@debian.org>

On 1/5/24 10:39 AM, Breno Leitao wrote:
> In some configurations, the 'iter' variable in function
> fib6_repair_tree() is unused, resulting the following warning when
> compiled with W=1.
> 
> 	net/ipv6/ip6_fib.c:1781:6: warning: variable 'iter' set but not used [-Wunused-but-set-variable]
> 	 1781 |         int iter = 0;
> 	      |             ^
> 
> Rewrite RT6_TRACE() macro to keep the variable in scope.
> 
> Clang 18 removes the trace completely from the binary when the trace is
> disabled[1], so, no overhead is expected with this change.
> 
> [1] Link: https://paste.debian.net/1303162/
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>  include/net/ip6_fib.h | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
> index 9ba6413fd2e3..d2ef60ebeb25 100644
> --- a/include/net/ip6_fib.h
> +++ b/include/net/ip6_fib.h
> @@ -30,11 +30,7 @@
>  
>  #define RT6_DEBUG 2
>  
> -#if RT6_DEBUG >= 3
> -#define RT6_TRACE(x...) pr_debug(x)
> -#else
> -#define RT6_TRACE(x...) do { ; } while (0)
> -#endif
> +#define RT6_TRACE(x...) do { if (RT6_DEBUG > 3) pr_debug(x); } while (0)
>  
>  struct rt6_info;
>  struct fib6_info;

I question the value of RT6_TRACE vs just using pr_debug; pr_debug has
zero cost until enabled and can be enabled by file or line. Not
requiring a kernel build is actual better.

[cc'ed Wei who added the macro]

  reply	other threads:[~2024-01-06 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 17:39 Breno Leitao
2024-01-06 16:13 ` David Ahern [this message]
2024-01-08 15:17   ` Breno Leitao

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=8ae4f9b0-1917-448d-a89b-11597549f89b@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=justinstitt@google.com \
    --cc=kuba@kernel.org \
    --cc=leit@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=weiwan@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

all inboxes | Powered by JetHome®