linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning
@ 2017-05-24  5:38 Nick Desaulniers
  2017-05-24  8:16 ` Sergey Senozhatsky
  2017-05-25  5:38 ` Minchan Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Desaulniers @ 2017-05-24  5:38 UTC (permalink / raw)
  Cc: md, mka, Nick Desaulniers, Minchan Kim, Nitin Gupta,
	Sergey Senozhatsky, linux-mm, linux-kernel

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning
  2017-05-24  5:38 [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning Nick Desaulniers
@ 2017-05-24  8:16 ` Sergey Senozhatsky
  2017-05-26  4:15   ` Nick Desaulniers
  2017-05-25  5:38 ` Minchan Kim
  1 sibling, 1 reply; 4+ messages in thread
From: Sergey Senozhatsky @ 2017-05-24  8:16 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: md, mka, Minchan Kim, Nitin Gupta, Sergey Senozhatsky, linux-mm,
	linux-kernel

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning
  2017-05-24  5:38 [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning Nick Desaulniers
  2017-05-24  8:16 ` Sergey Senozhatsky
@ 2017-05-25  5:38 ` Minchan Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Minchan Kim @ 2017-05-25  5:38 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: md, mka, Nitin Gupta, Sergey Senozhatsky, linux-mm, linux-kernel

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.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning
  2017-05-24  8:16 ` Sergey Senozhatsky
@ 2017-05-26  4:15   ` Nick Desaulniers
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2017-05-26  4:15 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: md, mka, Minchan Kim, Nitin Gupta, linux-mm, linux-kernel

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.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2017-05-26  4:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24  5:38 [PATCH] mm/zsmalloc: fix -Wunneeded-internal-declaration warning Nick Desaulniers
2017-05-24  8:16 ` Sergey Senozhatsky
2017-05-26  4:15   ` Nick Desaulniers
2017-05-25  5:38 ` Minchan Kim

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).