Re: [PATCH] mm/percpu: mark pcpu_chunk_type() as __maybe_unused

From: Stephen Rothwell
Date: Tue Jul 14 2020 - 08:53:21 EST


Hi Bixuan,

On Tue, 14 Jul 2020 13:41:01 +0000 Bixuan Cui <cuibixuan@xxxxxxxxxx> wrote:
>
> Gcc report the following warning without CONFIG_MEMCG_KMEM:
>
> mm/percpu-internal.h:145:29: warning: âpcpu_chunk_typeâ defined
> but not used [-Wunused-function]
> static enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk)
> ^~~~~~~~~~~~~~~
>
> Mark pcpu_chunk_type() as __maybe_unused to make it clear.

Given that it is in a header file, it should probably just be "static
inline" (which will also suppress the warning). As should
pcpu_is_memcg_chunk() and pcpu_chunk_list(). Also, without them being
inline, there will be a new copy for each file that
mm/percpu-internal.h is included in.

And that should be considered a fix for "mm: memcg/percpu: account
percpu memory to memory cgroups".

--
Cheers,
Stephen Rothwell

Attachment: pgp3lX2R6nrm_.pgp
Description: OpenPGP digital signature