Message ID | 6f1a8c76-d6d7-1a2c-8b0b-26a4a31f1a19@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] mm/percpu: fix 'defined but not used' warning | expand |
On Tue, Jul 14, 2020 at 09:46:18PM +0800, Bixuan Cui 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) > ^~~~~~~~~~~~~~~ > > Add 'inline' to pcpu_chunk_type(),pcpu_is_memcg_chunk() and > pcpu_chunk_list() to clear warning. Acked-by: Roman Gushchin <guro@fb.com> Thank you! > > Fixes: 26c99879ef01 ("mm: memcg/percpu: account percpu memory to memory cgroups") The "fixes" tag is not valid: the patch is in the mm queue, so it doesn't have a stable hash. Usually Andrew squashes such fixes into the original patch on merging. Thanks!
Hi Bixuan, Thanks for this. On Tue, 14 Jul 2020 21:46:18 +0800 Bixuan Cui <cuibixuan@huawei.com> 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) > ^~~~~~~~~~~~~~~ > > Add 'inline' to pcpu_chunk_type(),pcpu_is_memcg_chunk() and > pcpu_chunk_list() to clear warning. > > Fixes: 26c99879ef01 ("mm: memcg/percpu: account percpu memory to memory cgroups") > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> You really should not add SUB lines for others - in this case a Suggested-by is more appropriate.
On 2020/7/15 2:41, Roman Gushchin wrote: >> Fixes: 26c99879ef01 ("mm: memcg/percpu: account percpu memory to memory cgroups") > The "fixes" tag is not valid: the patch is in the mm queue, so it doesn't > have a stable hash. Usually Andrew squashes such fixes into the original patch > on merging. Thanks for your advice,delete it.
diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index 7983455842ff..18b768ac7dca 100644 --- a/mm/percpu-internal.h +++ b/mm/percpu-internal.h @@ -129,31 +129,31 @@ static inline int pcpu_chunk_map_bits(struct pcpu_chunk *chunk) } #ifdef CONFIG_MEMCG_KMEM -static enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) +static inline enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) { if (chunk->obj_cgroups) return PCPU_CHUNK_MEMCG; return PCPU_CHUNK_ROOT; } -static bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type) +static inline bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type) { return chunk_type == PCPU_CHUNK_MEMCG; } #else -static enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) +static inline enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) { return PCPU_CHUNK_ROOT; } -static bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type) +static inline bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type) { return false; } #endif -static struct list_head *pcpu_chunk_list(enum pcpu_chunk_type chunk_type) +static inline struct list_head *pcpu_chunk_list(enum pcpu_chunk_type chunk_type) { return &pcpu_chunk_lists[pcpu_nr_slots * pcpu_is_memcg_chunk(chunk_type)];