lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240905142220.49d93337a0abce5690e515d9@linux-foundation.org>
Date: Thu, 5 Sep 2024 14:22:20 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
 Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers
 <ndesaulniers@...gle.com>, Bill Wendling <morbo@...gle.com>, Justin Stitt
 <justinstitt@...gle.com>
Subject: Re: [PATCH v1 1/1] mm/page_alloc: Mark has_unaccepted_memory() with
 __maybe_unused

On Thu,  5 Sep 2024 20:15:53 +0300 Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:

> When has_unaccepted_memory() is unused, it prevents kernel builds
> with clang, `make W=1` and CONFIG_WERROR=y:
> 
> mm/page_alloc.c:7036:20: error: unused function 'has_unaccepted_memory' [-Werror,-Wunused-function]
>  7036 | static inline bool has_unaccepted_memory(void)
>       |                    ^~~~~~~~~~~~~~~~~~~~~
> 
> Fix this by marking it with __maybe_unused (all cases for the sake of
> symmetry).
> 
> See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
> inline functions for W=1 build").
> 

has_unaccepted_memory() has no callers if CONFIG_UNACCEPTED_MEMORY=n. 
Can't we do this better thing?


--- a/mm/page_alloc.c~a
+++ a/mm/page_alloc.c
@@ -288,7 +288,6 @@ EXPORT_SYMBOL(nr_online_nodes);
 static bool page_contains_unaccepted(struct page *page, unsigned int order);
 static void accept_page(struct page *page, unsigned int order);
 static bool cond_accept_memory(struct zone *zone, unsigned int order);
-static inline bool has_unaccepted_memory(void);
 static bool __free_unaccepted(struct page *page);
 
 int page_group_by_mobility_disabled __read_mostly;
@@ -6963,6 +6962,11 @@ static bool try_to_accept_memory_one(str
 	return true;
 }
 
+static inline bool has_unaccepted_memory(void)
+{
+	return static_branch_unlikely(&zones_with_unaccepted_pages);
+}
+
 static bool cond_accept_memory(struct zone *zone, unsigned int order)
 {
 	long to_accept;
@@ -6990,11 +6994,6 @@ static bool cond_accept_memory(struct zo
 	return ret;
 }
 
-static inline bool has_unaccepted_memory(void)
-{
-	return static_branch_unlikely(&zones_with_unaccepted_pages);
-}
-
 static bool __free_unaccepted(struct page *page)
 {
 	struct zone *zone = page_zone(page);
@@ -7032,11 +7031,6 @@ static bool cond_accept_memory(struct zo
 {
 	return false;
 }
-
-static inline bool has_unaccepted_memory(void)
-{
-	return false;
-}
 
 static bool __free_unaccepted(struct page *page)
 {
_


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ