[PATCH] mm/page: Drop has_unaccepted_memory() helper

From: Kirill A. Shutemov
Date: Mon Sep 09 2024 - 04:24:34 EST


has_unaccepted_memory() has the only caller -- cond_accept_memory().

Remove the helper and check zones_with_unaccepted_pages directly in
cond_accept_memory().

It also fixes warning with clang 18 when kernel is compiled without
unaccepted memory support:

mm/page_alloc.c:7043:20: error: unused function 'has_unaccepted_memory' [-Werror,-Wunused-function]

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202409061101.Jlx5z2fI-lkp@xxxxxxxxx/
---
mm/page_alloc.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 91ace8ca97e2..7fc5af7cb387 100644
--- a/mm/page_alloc.c
+++ b/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;
@@ -6975,7 +6974,7 @@ static bool cond_accept_memory(struct zone *zone, unsigned int order)
long to_accept;
bool ret = false;

- if (!has_unaccepted_memory())
+ if (!static_branch_unlikely(&zones_with_unaccepted_pages))
return false;

if (list_empty(&zone->unaccepted_pages))
@@ -6997,11 +6996,6 @@ static bool cond_accept_memory(struct zone *zone, unsigned int order)
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);
@@ -7040,11 +7034,6 @@ static bool cond_accept_memory(struct zone *zone, unsigned int order)
return false;
}

-static inline bool has_unaccepted_memory(void)
-{
- return false;
-}
-
static bool __free_unaccepted(struct page *page)
{
BUILD_BUG();
--
2.45.2