linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: sxwjean@me.com
Cc: vbabka@suse.cz, surenb@google.com, cl@linux.co,
	penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com,
	akpm@linux-foundation.org, roman.gushchin@linux.dev,
	42.hyeyoo@gmail.com, xiongwei.song@linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>,
	Nathan Chancellor <nathan@kernel.org>,
	llvm@lists.linux.dev, Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH] mm/slub: quiet the clang warning with -Wunused-function enabled
Date: Wed, 10 Jul 2024 04:03:33 +0100	[thread overview]
Message-ID: <Zo36BTqhzGkukyT_@casper.infradead.org> (raw)
In-Reply-To: <20240710025418.394321-1-sxwjean@me.com>

On Wed, Jul 10, 2024 at 10:54:18AM +0800, sxwjean@me.com wrote:
> From: Xiongwei Song <xiongwei.song@linux.dev>
> 
> The only user of prepare_slab_obj_exts_hook() is
> alloc_tagging_slab_alloc_hook(), which can build with
> CONFIG_MEM_ALLOC_PROFILING enabled. So, the warning was triggerred
> when disabling CONFIG_MEM_ALLOC_PROFILING. Let's add "__maybe_unused"
> for prepare_slab_obj_exts_hook().

Perhaps instead clang can be fixed to match gcc's behaviour?

> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202407050845.zNONqauD-lkp@intel.com/
> Signed-off-by: Xiongwei Song <xiongwei.song@linux.dev>
> ---
>  mm/slub.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index ce39544acf7c..2e26f20759c0 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2027,7 +2027,7 @@ static inline bool need_slab_obj_ext(void)
>  	return false;
>  }
>  
> -static inline struct slabobj_ext *
> +static inline struct slabobj_ext * __maybe_unused
>  prepare_slab_obj_exts_hook(struct kmem_cache *s, gfp_t flags, void *p)
>  {
>  	struct slab *slab;
> @@ -2068,7 +2068,7 @@ static inline bool need_slab_obj_ext(void)
>  	return false;
>  }
>  
> -static inline struct slabobj_ext *
> +static inline struct slabobj_ext * __maybe_unused
>  prepare_slab_obj_exts_hook(struct kmem_cache *s, gfp_t flags, void *p)
>  {
>  	return NULL;
> -- 
> 2.34.1
> 
> 


  reply	other threads:[~2024-07-10  3:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10  2:54 sxwjean
2024-07-10  3:03 ` Matthew Wilcox [this message]
2024-07-10  3:16   ` xiongwei.song
2024-07-10 15:01   ` Nathan Chancellor
2024-07-10 21:40     ` Suren Baghdasaryan
2024-07-11  7:43       ` Vlastimil Babka
2024-07-11 13:56         ` Suren Baghdasaryan
2024-07-11 17:06           ` Suren Baghdasaryan

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=Zo36BTqhzGkukyT_@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.co \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=surenb@google.com \
    --cc=sxwjean@me.com \
    --cc=vbabka@suse.cz \
    --cc=xiongwei.song@linux.dev \
    /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