linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mm/mmap_lock: fix warning when CONFIG_TRACING is not defined
@ 2021-05-31  1:55 Bixuan Cui
  2021-05-31  2:02 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Bixuan Cui @ 2021-05-31  1:55 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Bixuan Cui

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="y", Size: 901 bytes --]

Fix the warning: [-Wunused-function]
mm/mmap_lock.c:157:20: warning: ‘get_mm_memcg_path’ defined but not used
 static const char *get_mm_memcg_path(struct mm_struct *mm)
                    ^~~~~~~~~~~~~~~~~

Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
 mm/mmap_lock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
index 03ee85c696ef..ec7899b08690 100644
--- a/mm/mmap_lock.c
+++ b/mm/mmap_lock.c
@@ -154,7 +154,7 @@ static inline void put_memcg_path_buf(void)
  * The caller must call put_memcg_path_buf() once the buffer is no longer
  * needed. This must be done while preemption is still disabled.
  */
-static const char *get_mm_memcg_path(struct mm_struct *mm)
+static const char __maybe_unused *get_mm_memcg_path(struct mm_struct *mm)
 {
 	char *buf = NULL;
 	struct mem_cgroup *memcg = get_mem_cgroup_from_mm(mm);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] mm/mmap_lock: fix warning when CONFIG_TRACING is not defined
  2021-05-31  1:55 [PATCH -next] mm/mmap_lock: fix warning when CONFIG_TRACING is not defined Bixuan Cui
@ 2021-05-31  2:02 ` Matthew Wilcox
  2021-05-31  3:34   ` Bixuan Cui
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2021-05-31  2:02 UTC (permalink / raw)
  To: Bixuan Cui; +Cc: akpm, linux-mm, linux-kernel

On Mon, May 31, 2021 at 09:55:27AM +0800, Bixuan Cui wrote:
> Fix the warning: [-Wunused-function]
> mm/mmap_lock.c:157:20: warning: ‘get_mm_memcg_path’ defined but not used
>  static const char *get_mm_memcg_path(struct mm_struct *mm)
>                     ^~~~~~~~~~~~~~~~~

That seems like the wrong way to fix the warning.  Why not put it
under an appropriate ifdef?

> Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
> ---
>  mm/mmap_lock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
> index 03ee85c696ef..ec7899b08690 100644
> --- a/mm/mmap_lock.c
> +++ b/mm/mmap_lock.c
> @@ -154,7 +154,7 @@ static inline void put_memcg_path_buf(void)
>   * The caller must call put_memcg_path_buf() once the buffer is no longer
>   * needed. This must be done while preemption is still disabled.
>   */
> -static const char *get_mm_memcg_path(struct mm_struct *mm)
> +static const char __maybe_unused *get_mm_memcg_path(struct mm_struct *mm)
>  {
>  	char *buf = NULL;
>  	struct mem_cgroup *memcg = get_mem_cgroup_from_mm(mm);
> -- 
> 2.17.1
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] mm/mmap_lock: fix warning when CONFIG_TRACING is not defined
  2021-05-31  2:02 ` Matthew Wilcox
@ 2021-05-31  3:34   ` Bixuan Cui
  0 siblings, 0 replies; 3+ messages in thread
From: Bixuan Cui @ 2021-05-31  3:34 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: akpm, linux-mm, linux-kernel



On 2021/5/31 10:02, Matthew Wilcox wrote:
>> Fix the warning: [-Wunused-function]
>> mm/mmap_lock.c:157:20: warning: ‘get_mm_memcg_path’ defined but not used
>>  static const char *get_mm_memcg_path(struct mm_struct *mm)
>>                     ^~~~~~~~~~~~~~~~~
> That seems like the wrong way to fix the warning.  Why not put it
> under an appropriate ifdef?
It's better than me, I will send a new patch.

Thanks
Bixuan Cui

> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-31  3:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  1:55 [PATCH -next] mm/mmap_lock: fix warning when CONFIG_TRACING is not defined Bixuan Cui
2021-05-31  2:02 ` Matthew Wilcox
2021-05-31  3:34   ` 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).