[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210705103806.2339467-1-elver@google.com>
Date: Mon, 5 Jul 2021 12:38:06 +0200
From: Marco Elver <elver@...gle.com>
To: elver@...gle.com, akpm@...ux-foundation.org
Cc: glider@...gle.com, dvyukov@...gle.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
kasan-dev@...glegroups.com, Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Vlastimil Babka <vbabka@...e.cz>,
Yang Shi <shy828301@...il.com>, bpf@...r.kernel.org,
Mel Gorman <mgorman@...hsingularity.net>,
Alexei Starovoitov <ast@...nel.org>
Subject: [PATCH] Revert "mm/page_alloc: make should_fail_alloc_page() static"
This reverts commit f7173090033c70886d925995e9dfdfb76dbb2441.
Commit 76cd61739fd1 ("mm/error_inject: Fix allow_error_inject function
signatures") explicitly made should_fail_alloc_page() non-static, due to
worries of remaining compiler optimizations in the absence of function
side-effects while being noinline.
Furthermore, kernel/bpf/verifier.c pushes should_fail_alloc_page onto
the btf_non_sleepable_error_inject BTF IDs set, which when enabling
CONFIG_DEBUG_INFO_BTF results in an error at the BTFIDS stage:
FAILED unresolved symbol should_fail_alloc_page
To avoid the W=1 warning, add a function declaration right above the
function itself, with a comment it is required in a BTF IDs set.
Fixes: f7173090033c ("mm/page_alloc: make should_fail_alloc_page() static")
Cc: Mel Gorman <mgorman@...hsingularity.net>
Cc: Alexei Starovoitov <ast@...nel.org>
Signed-off-by: Marco Elver <elver@...gle.com>
---
mm/page_alloc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d6e94cc8066c..16e71d48d84e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3831,7 +3831,13 @@ static inline bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
#endif /* CONFIG_FAIL_PAGE_ALLOC */
-static noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
+/*
+ * should_fail_alloc_page() is only called by page_alloc.c, however, is also
+ * included in a BTF IDs set and must remain non-static. Declare it to avoid a
+ * "missing prototypes" warning, and make it clear this is intentional.
+ */
+bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order);
+noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
{
return __should_fail_alloc_page(gfp_mask, order);
}
--
2.32.0.93.g670b81a890-goog
Powered by blists - more mailing lists