Skip to contentSkip to conversation

mm: page_alloc: Avoid defining unused function

PATCH Superseded Andy Shevchenko 2 participants 3 messages Apr 23, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: page_alloc: Avoid defining unused function

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 for add_to_free_list().

---
 mm/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)
mm/page_alloc.c +2 -0
index 33d4a1be927b..0fb796b700a4 100644
@@ -653,6 +653,7 @@ static inline void __add_to_free_list(struct page *page, struct zone *zone,
 	area->nr_free++;
 }
 
+#ifdef CONFIG_MEMORY_FAILURE
 static inline void add_to_free_list(struct page *page, struct zone *zone,
 				    unsigned int order, int migratetype,
 				    bool tail)
@@ -660,6 +661,7 @@ static inline void add_to_free_list(struct page *page, struct zone *zone,
 	__add_to_free_list(page, zone, order, migratetype, tail);
 	account_freepages(zone, 1 << order, migratetype);
 }
+#endif
 
 /*
  * Used for pages which are on another list. Move the pages to the tail
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#1 lore raw
Quoted 4 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,
do the same for add_to_free_list().

Why not relocate it within the existing CONFIG_MEMORY_FAILURE block?

Quoted 30 lines
---
 mm/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)
mm/page_alloc.c +2 -0
index 33d4a1be927b..0fb796b700a4 100644
@@ -653,6 +653,7 @@ static inline void __add_to_free_list(struct page *page, struct zone *zone,
 	area->nr_free++;
 }
 
+#ifdef CONFIG_MEMORY_FAILURE
 static inline void add_to_free_list(struct page *page, struct zone *zone,
 				    unsigned int order, int migratetype,
 				    bool tail)
@@ -660,6 +661,7 @@ static inline void add_to_free_list(struct page *page, struct zone *zone,
 	__add_to_free_list(page, zone, order, migratetype, tail);
 	account_freepages(zone, 1 << order, migratetype);
 }
+#endif
 
 /*
  * Used for pages which are on another list. Move the pages to the tail
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#2 lore raw
Quoted 7 lines · Liam R. Howlett
Quoted 4 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,
do the same for add_to_free_list().

Why not relocate it within the existing CONFIG_MEMORY_FAILURE block?

No objections, I'm not familiar with the idea behind this helper.

Signature · 2 lines
With Best Regards,
Andy Shevchenko