Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1649133 > unrolled thread

[PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning

Started byNick Desaulniers <nick.desaulniers@gmail.com>
First post2017-05-24 07:50 +0200
Last post2017-05-25 07:40 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-05-24 07:50 +0200
    Re: [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-05-24 10:20 +0200
      Re: [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-05-26 06:20 +0200
    Re: [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning Minchan Kim <minchan@kernel.org> - 2017-05-25 07:40 +0200

#1649133 — [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning

FromNick Desaulniers <nick.desaulniers@gmail.com>
Date2017-05-24 07:50 +0200
Subject[PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning
Message-ID<tKxlf-6tH-1@gated-at.bofh.it>
is_first_page() is only called from the macro VM_BUG_ON_PAGE() which is
only compiled in as a runtime check when CONFIG_DEBUG_VM is set,
otherwise is checked at compile time and not actually compiled in.

Fixes the following warning, found with Clang:

mm/zsmalloc.c:472:12: warning: function 'is_first_page' is not needed and
will not be emitted [-Wunneeded-internal-declaration]
static int is_first_page(struct page *page)
           ^

Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
---
 mm/zsmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index d41edd28298b..15959d35fc26 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -469,7 +469,7 @@ static bool is_zspage_isolated(struct zspage *zspage)
 	return zspage->isolated;
 }
 
-static int is_first_page(struct page *page)
+static __maybe_unused int is_first_page(struct page *page)
 {
 	return PagePrivate(page);
 }
-- 
2.11.0

[toc] | [next] | [standalone]


#1649223

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-05-24 10:20 +0200
Message-ID<tKzGq-8dC-17@gated-at.bofh.it>
In reply to#1649133
On (05/23/17 22:38), Nick Desaulniers wrote:
> 
> is_first_page() is only called from the macro VM_BUG_ON_PAGE() which is
> only compiled in as a runtime check when CONFIG_DEBUG_VM is set,
> otherwise is checked at compile time and not actually compiled in.
> 
> Fixes the following warning, found with Clang:
> 
> mm/zsmalloc.c:472:12: warning: function 'is_first_page' is not needed and
> will not be emitted [-Wunneeded-internal-declaration]
> static int is_first_page(struct page *page)
>            ^
> 
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>

well, no objections from my side. MM seems to be getting more and
more `__maybe_unused' annotations because of clang.

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

[toc] | [prev] | [next] | [standalone]


#1651068

FromNick Desaulniers <nick.desaulniers@gmail.com>
Date2017-05-26 06:20 +0200
Message-ID<tLeTf-13U-5@gated-at.bofh.it>
In reply to#1649223
On Wed, May 24, 2017 at 05:16:18PM +0900, Sergey Senozhatsky wrote:
> On (05/23/17 22:38), Nick Desaulniers wrote:
> > Fixes the following warning, found with Clang:
> well, no objections from my side. MM seems to be getting more and
> more `__maybe_unused' annotations because of clang.

Indeed, but does find bugs when this warning pops up unexpected (unlike
in this particular instance). See:

https://patchwork.kernel.org/patch/9738897/
https://www.spinics.net/lists/intel-gfx/msg128737.html

TL;DR
>>> You have actually uncovered a bug here where the call is not
>>> supposed to be optional in the first place.

[toc] | [prev] | [next] | [standalone]


#1650182

FromMinchan Kim <minchan@kernel.org>
Date2017-05-25 07:40 +0200
Message-ID<tKTF7-45C-11@gated-at.bofh.it>
In reply to#1649133
On Tue, May 23, 2017 at 10:38:57PM -0700, Nick Desaulniers wrote:
> is_first_page() is only called from the macro VM_BUG_ON_PAGE() which is
> only compiled in as a runtime check when CONFIG_DEBUG_VM is set,
> otherwise is checked at compile time and not actually compiled in.
> 
> Fixes the following warning, found with Clang:
> 
> mm/zsmalloc.c:472:12: warning: function 'is_first_page' is not needed and
> will not be emitted [-Wunneeded-internal-declaration]
> static int is_first_page(struct page *page)
>            ^
> 
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>

Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web