* Re: [PATCH] mm/percpu: mark pcpu_chunk_type() as __maybe_unused
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
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Stephen Rothwell @ 2020-07-14 12:53 UTC (permalink / raw)
To: Bixuan Cui
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
[-- Attachment #1: Type: text/plain, Size: 891 bytes --]
Hi Bixuan,
On Tue, 14 Jul 2020 13:41:01 +0000 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)
> ^~~~~~~~~~~~~~~
>
> 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm/percpu: mark pcpu_chunk_type() as __maybe_unused
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:46 ` Bixuan Cui
2 siblings, 0 replies; 12+ messages in thread
From: Bixuan Cui @ 2020-07-14 13:33 UTC (permalink / raw)
To: Stephen Rothwell
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
On 2020/7/14 20:53, Stephen Rothwell wrote:
> Hi Bixuan,
>
> On Tue, 14 Jul 2020 13:41:01 +0000 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)
>> ^~~~~~~~~~~~~~~
>>
>> 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".
Thinks,i will fix it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2] mm/percpu: fix 'defined but not used' warning
2020-07-14 12:53 ` Stephen Rothwell
2020-07-14 13:33 ` Bixuan Cui
@ 2020-07-14 13:34 ` Bixuan Cui
2020-07-14 13:45 ` Bixuan Cui
2020-07-14 13:46 ` Bixuan Cui
2 siblings, 1 reply; 12+ messages in thread
From: Bixuan Cui @ 2020-07-14 13:34 UTC (permalink / raw)
To: Stephen Rothwell
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
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>
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
.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] mm/percpu: mark pcpu_chunk_type() as __maybe_unused
@ 2020-07-14 13:41 Bixuan Cui
2020-07-14 12:53 ` Stephen Rothwell
0 siblings, 1 reply; 12+ messages in thread
From: Bixuan Cui @ 2020-07-14 13:41 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, linux-next, cuibixuan, john.wanghui
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.
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
mm/percpu-internal.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h
index 7983455842ff..8a8a230bd957 100644
--- a/mm/percpu-internal.h
+++ b/mm/percpu-internal.h
@@ -129,7 +129,7 @@ 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 enum pcpu_chunk_type __maybe_unused pcpu_chunk_type(struct pcpu_chunk *chunk)
{
if (chunk->obj_cgroups)
return PCPU_CHUNK_MEMCG;
@@ -142,7 +142,7 @@ static bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type)
}
#else
-static enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk)
+static enum pcpu_chunk_type __maybe_unused pcpu_chunk_type(struct pcpu_chunk *chunk)
{
return PCPU_CHUNK_ROOT;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2] mm/percpu: fix 'defined but not used' warning
2020-07-14 13:34 ` [PATCH v2] mm/percpu: fix 'defined but not used' warning Bixuan Cui
@ 2020-07-14 13:45 ` Bixuan Cui
0 siblings, 0 replies; 12+ messages in thread
From: Bixuan Cui @ 2020-07-14 13:45 UTC (permalink / raw)
To: Stephen Rothwell
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
On 2020/7/14 21:34, Bixuan Cui wrote:
> mm/percpu-internal.h:145:29: warning: ‘pcpu_chunk_type’ defined
> but not used [-Wunused-function]
Please ignore this email, I will resend the v2 patch.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2] mm/percpu: fix 'defined but not used' warning
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:46 ` Bixuan Cui
2020-07-14 18:41 ` Roman Gushchin
2020-07-14 20:22 ` Stephen Rothwell
2 siblings, 2 replies; 12+ messages in thread
From: Bixuan Cui @ 2020-07-14 13:46 UTC (permalink / raw)
To: Stephen Rothwell
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
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>
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
.
.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2] mm/percpu: fix 'defined but not used' warning
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
1 sibling, 1 reply; 12+ messages in thread
From: Roman Gushchin @ 2020-07-14 18:41 UTC (permalink / raw)
To: Bixuan Cui
Cc: Stephen Rothwell, akpm, linux-mm, linux-kernel, linux-next, john.wanghui
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!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] mm/percpu: fix 'defined but not used' warning
2020-07-14 13:46 ` Bixuan Cui
2020-07-14 18:41 ` Roman Gushchin
@ 2020-07-14 20:22 ` Stephen Rothwell
2020-07-15 0:25 ` [PATCH v3] " Bixuan Cui
1 sibling, 1 reply; 12+ messages in thread
From: Stephen Rothwell @ 2020-07-14 20:22 UTC (permalink / raw)
To: Bixuan Cui
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
[-- Attachment #1: Type: text/plain, Size: 796 bytes --]
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.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] mm/percpu: fix 'defined but not used' warning
2020-07-14 18:41 ` Roman Gushchin
@ 2020-07-15 0:24 ` Bixuan Cui
0 siblings, 0 replies; 12+ messages in thread
From: Bixuan Cui @ 2020-07-15 0:24 UTC (permalink / raw)
To: Roman Gushchin
Cc: Stephen Rothwell, akpm, linux-mm, linux-kernel, linux-next, john.wanghui
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3] mm/percpu: fix 'defined but not used' warning
2020-07-14 20:22 ` Stephen Rothwell
@ 2020-07-15 0:25 ` Bixuan Cui
2020-07-15 1:50 ` Stephen Rothwell
0 siblings, 1 reply; 12+ messages in thread
From: Bixuan Cui @ 2020-07-15 0:25 UTC (permalink / raw)
To: Stephen Rothwell
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
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
.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3] mm/percpu: fix 'defined but not used' warning
2020-07-15 0:25 ` [PATCH v3] " Bixuan Cui
@ 2020-07-15 1:50 ` Stephen Rothwell
2020-07-15 2:18 ` Bixuan Cui
0 siblings, 1 reply; 12+ messages in thread
From: Stephen Rothwell @ 2020-07-15 1:50 UTC (permalink / raw)
To: Bixuan Cui
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
[-- Attachment #1: Type: text/plain, Size: 826 bytes --]
Hi all,
On Wed, 15 Jul 2020 08:25:19 +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.
>
> 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(-)
I have added this patch to linux-next today.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3] mm/percpu: fix 'defined but not used' warning
2020-07-15 1:50 ` Stephen Rothwell
@ 2020-07-15 2:18 ` Bixuan Cui
0 siblings, 0 replies; 12+ messages in thread
From: Bixuan Cui @ 2020-07-15 2:18 UTC (permalink / raw)
To: Stephen Rothwell
Cc: akpm, linux-mm, linux-kernel, linux-next, john.wanghui, Roman Gushchin
On 2020/7/15 9:50, Stephen Rothwell wrote:
> I have added this patch to linux-next today.
thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-07-15 2:19 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v3] " Bixuan Cui
2020-07-15 1:50 ` Stephen Rothwell
2020-07-15 2:18 ` Bixuan Cui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).