mm/page: Drop has_unaccepted_memory() helper
Subsystems (2)
PATCH 1/1 mm/page: Drop has_unaccepted_memory() helper
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]
--- mm/page_alloc.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
mm/page_alloc.c +1 -12
@@ -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 ();
Signature · 1 line
2.45.2
Quoted 5 lines · Kirill A. Shutemov
has_unaccepted_memory()has the only caller --cond_accept_memory().Remove the helper and check
zones_with_unaccepted_pagesdirectly incond_accept_memory().
Quoted 8 lines
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]
Quoted 52 lines
--- mm/page_alloc.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)mm/page_alloc.c +1
-12@@ -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 ();Signature · 1 line
2.45.2
Signature · 2 lines
Sincerely yours, Mike.
Quoted 8 lines · Kirill A. Shutemov
has_unaccepted_memory()has the only caller --cond_accept_memory().Remove the helper and check
zones_with_unaccepted_pagesdirectly incond_accept_memory().It also fixes warning with clang 18 when kernel is compiled without unaccepted memory support:
Quoted 6 lines
mm/page_alloc.c:7043:20: error: unused function 'has_unaccepted_memory' [-Werror,-Wunused-function]Signed-off-by Kirill A. Shutemov <[email protected]>Reported-by kernel test robot <[email protected]>---
Signature · 3 lines
Cheers, David / dhildenb
Andrew Morton
maintainerQuoted 10 lines · On Mon, 9 Sep 2024 11:19:30 +0300 "Kirill A. Shutemov"…
has_unaccepted_memory()has the only caller --cond_accept_memory().Remove the helper and check
zones_with_unaccepted_pagesdirectly incond_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]
Thanks, mm-unstable has a similar fix:
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-fix-build-with-config_unaccepted_memory=n +5 -11
@@ -287,7 +287,6 @@ EXPORT_SYMBOL(nr_online_nodes);static bool page_contains_unaccepted (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 ;
@@ -7068,6 +7067,11 @@ static bool try_to_accept_memory_one(strreturn 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;
@@ -7095,11 +7099,6 @@ static bool cond_accept_memory(struct zoreturn 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);
@@ -7134,11 +7133,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) {
_
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Mon, 9 Sep 2024 11:19:30 +0300 "Kirill A. Shutemov"…
has_unaccepted_memory()has the only caller --cond_accept_memory().Remove the helper and check
zones_with_unaccepted_pagesdirectly incond_accept_memory().
Quoted 7 lines
Quoted 5 lines
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]Thanks, mm-unstable has a similar fix:
Works for me.
Signature · 1 line
Kiryl Shutsemau / Kirill A. Shutemov