linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bixuan Cui <cuibixuan@huawei.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <linux-next@vger.kernel.org>,
	<john.wanghui@huawei.com>, Roman Gushchin <guro@fb.com>
Subject: [PATCH v3] mm/percpu: fix 'defined but not used' warning
Date: Wed, 15 Jul 2020 08:25:19 +0800	[thread overview]
Message-ID: <6d41b939-a741-b521-a7a2-e7296ec16219@huawei.com> (raw)
In-Reply-To: <20200715062229.78591ff9@canb.auug.org.au>

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>
Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
 mm/percpu-internal.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

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)];
-- 
2.17.1


.




  reply	other threads:[~2020-07-15  0:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 13:41 [PATCH] mm/percpu: mark pcpu_chunk_type() as __maybe_unused Bixuan Cui
2020-07-14 12:53 ` Stephen Rothwell
2020-07-14 13:33   ` Bixuan Cui
2020-07-14 13:34   ` [PATCH v2] mm/percpu: fix 'defined but not used' warning Bixuan Cui
2020-07-14 13:45     ` Bixuan Cui
2020-07-14 13:46   ` Bixuan Cui
2020-07-14 18:41     ` Roman Gushchin
2020-07-15  0:24       ` Bixuan Cui
2020-07-14 20:22     ` Stephen Rothwell
2020-07-15  0:25       ` Bixuan Cui [this message]
2020-07-15  1:50         ` [PATCH v3] " Stephen Rothwell
2020-07-15  2:18           ` Bixuan Cui

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=6d41b939-a741-b521-a7a2-e7296ec16219@huawei.com \
    --to=cuibixuan@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=john.wanghui@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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