mm: page_alloc: Avoid defining unused function
Subsystems (2)
PATCH v2 1/1 mm: page_alloc: Avoid defining unused function
In some configurations I gotmm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,
do the same for add_to_free_list().
---
v2: moved the function down to the respective ifdeffery block (Liam)
mm/page_alloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
mm/page_alloc.c +8 -8
@@ -653,14 +653,6 @@ static inline void __add_to_free_list(struct page *page, struct zone *zone, area->nr_free++; } -static inline void add_to_free_list (struct page *page,struct zone *zone, -unsigned int order,int migratetype, -bool tail) -{ -__add_to_free_list (page, zone, order, migratetype, tail); -account_freepages (zone,1 << order, migratetype); -} -/* * Used for pages which are on another list. Move the pages to the tail * of the list - so the moved pages won't immediately be considered for
@@ -6776,6 +6768,14 @@ bool is_free_buddy_page(const struct page *page)EXPORT_SYMBOL (is_free_buddy_page);#ifdef CONFIG_MEMORY_FAILURE +static inline void add_to_free_list (struct page *page,struct zone *zone, +unsigned int order,int migratetype, +bool tail) +{ +__add_to_free_list (page, zone, order, migratetype, tail); +account_freepages (zone,1 << order, migratetype); +} +/* * Break down a higher-order page in sub-pages, and keep our target out of * buddy allocator.
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andrew Morton
maintainerQuoted 27 lines · On Tue, 23 Apr 2024 19:14:43 +0300 Andy Shevchenko…
In some configurations I got
mm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,
do the same foradd_to_free_list().mm/page_alloc.c +1
-8@@ -653,14 +653,6 @@ static inline void __add_to_free_list(struct page *page, struct zone *zone, area->nr_free++; } -static inline void add_to_free_list (struct page *page,struct zone *zone, -unsigned int order,int migratetype, -bool tail) -{ -__add_to_free_list (page, zone, order, migratetype, tail); -account_freepages (zone,1 << order, migratetype); -} -/* * Used for pages which are on another list. Move the pages to the tail * of the list - so the moved pages won't immediately be considered for @@ -6776,6 +6768,14 @@ bool is_free_buddy_page(const struct page *page)EXPORT_SYMBOL (is_free_buddy_page);#ifdef CONFIG_MEMORY_FAILURE +static inline void add_to_free_list(struct page *page, struct zone *zone,
mm/page_alloc.c bool is_free_buddy_page(const struct page *page) · line 6781
Quoted 10 lines
mm/page_alloc.c +7
-0+ unsigned int order, int migratetype, + bool tail) +{ +__add_to_free_list (page ,zone ,order ,migratetype ,tail ); +account_freepages (zone,1 << order, migratetype); +} +/* * Break down a higher-order page in sub-pages, and keep our target out of * buddy allocator.
Thanks, I'll queue this as a fix against "mm: page_alloc: consolidate free page accounting".
Please do tell us the config when fixing these things. That way I can do a little bisect to ensure that I correctly identified the offending patch.
Quoted 5 lines · Andrew Morton
Quoted 4 lines · On Tue, 23 Apr 2024 19:14:43 +0300 Andy Shevchenko…
In some configurations I got
mm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,
do the same foradd_to_free_list().
...
Quoted 2 lines
Thanks, I'll queue this as a fix against "mm:
page_alloc: consolidate free page accounting".
Thank you!
Quoted 3 lines
Please do tell us the config when fixing these things. That way I can do a little bisect to ensure that I correctly identified the offending patch.
Hmm... You mean defconfig? I can share it.
I built this with make W=1, probably that one helps, but the MM parts of the defconfig have not been altered by me from the x86_64_defconfig.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Andrew Morton
Quoted 4 lines · On Tue, 23 Apr 2024 19:14:43 +0300 Andy Shevchenko…
In some configurations I got
mm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,
do the same foradd_to_free_list().
Quoted 6 lines
...
Quoted 2 lines
Thanks, I'll queue this as a fix against "mm:
page_alloc: consolidate free page accounting".Thank you!
Thanks for the fix. We switched most callsites to __add_to_free_list() now, I didn't realize the memory failure code was the only one left.
Quoted 10 lines · Johannes Weiner
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · Andrew Morton
Quoted 4 lines · On Tue, 23 Apr 2024 19:14:43 +0300 Andy Shevchenko…
In some configurations I got
mm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,
do the same foradd_to_free_list()....
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Thanks, I'll queue this as a fix against "mm:
page_alloc: consolidate free page accounting".Thank you!
Thanks for the fix. We switched most callsites to
__add_to_free_list()now, I didn't realize the memory failure code was the only one left.
You're welcome! Hint to the future make W=1 should be a must during development.
Quoted 1 line
Acked-by Johannes Weiner <[email protected]>
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
In some configurations I got
mm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,
guarged? ifdeffery?
Quoted 1 line
do the same for
add_to_free_list().
A Fixes tag might be needed.
Quoted 2 lines
Signed-off-by Andy Shevchenko <[email protected]>
Anyway, this patch looks good to me. Thanks.
Thanks.
.
Quoted 6 lines · Miaohe Lin
Quoted 3 lines · Andy Shevchenko
In some configurations I got
mm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,guarged?
A typo, thanks!
Quoted 1 line
ifdeffery?
Yes, this is established term.
Quoted 3 lines
Quoted 1 line
do the same for
add_to_free_list().A Fixes tag might be needed.
First of all, it's not really critical issue to fix. Also see below.
Quoted 5 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>Anyway, this patch looks good to me. Thanks.
Reviewed-by Miaohe Lin <[email protected]>
Thank you, I believe it will be squashed to the original one as Andrew already accepted it. But at the same time his workflow allows to update the commit message in case it's going to be a separate change.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Miaohe Lin
On 2024/4/24 0:14, Andy Shevchenko wrote:
...
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
In some configurations I got
mm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,guarged?
A typo, thanks!
FWIW, Andrew fixed this along with "Because". Thank you, Andrew!
Quoted 5 lines
Quoted 1 line
ifdeffery?
Yes, this is established term.
Quoted 1 line
Quoted 1 line
do the same for
add_to_free_list().
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Miaohe Lin
On 2024/4/24 0:14, Andy Shevchenko wrote:
...
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
In some configurations I got
mm/page_alloc.c:656:20: warning: unused function 'add_to_free_list' [-Wunused-function] Becuase the only user is guarged with a certain ifdeffery,
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
guarged?
A typo, thanks!
FWIW, Andrew fixed this along with "Because". Thank you, Andrew!
Got it. Thanks both.
.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
ifdeffery?
Yes, this is established term.
Quoted 1 line
Quoted 1 line
do the same for
add_to_free_list().