mm/page_alloc: Simplify free_page_is_bad by removing free_page_is_bad_report
Subsystems (2)
PATCH v3 1/1 mm/page_alloc: Simplify free_page_is_bad by removing free_page_is_bad_report
From: Ye Liu <[email protected]>
Refactors the free_page_is_bad function by directly calling bad_page() instead of using the intermediary function free_page_is_bad_report(). The removal of free_page_is_bad_report() reduces unnecessary indirection, making the code cleaner and easier to read.
The functionality remains the same, as free_page_is_bad_report() was merely a wrapper for the bad_page() call. The patch also improves maintainability by reducing the function call depth.
---
V3: Delete 'This patch'.
V2: Simplify the code by removing unnecessary line breaks.
---
--- mm/page_alloc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
mm/page_alloc.c +1 -7
@@ -933,19 +933,13 @@ static const char *page_bad_reason(struct page *page, unsigned long flags)return bad_reason; } -static void free_page_is_bad_report (struct page *page) -{ -bad_page (page, -page_bad_reason (page,PAGE_FLAGS_CHECK_AT_FREE )); -} -static inline bool free_page_is_bad (struct page *page) {if (likely (page_expected_state (page,PAGE_FLAGS_CHECK_AT_FREE )))return false;/* Something has gone sideways, find it */ -free_page_is_bad_report (page); +bad_page (page,page_bad_reason (page,PAGE_FLAGS_CHECK_AT_FREE ));return true; }
Signature · 1 line
2.25.1
Quoted 10 lines · Ye Liu
From: Ye Liu <[email protected]>
Refactors the
free_page_is_badfunction by directly callingbad_page()instead of using the intermediary functionfree_page_is_bad_report(). The removal offree_page_is_bad_report()reduces unnecessary indirection, making the code cleaner and easier to read.The functionality remains the same, as
free_page_is_bad_report()was merely a wrapper for thebad_page()call. The patch also improves maintainability by reducing the function call depth.
I would trim this down.
Quoted 3 lines
Signed-off-by Ye Liu <[email protected]>Reviewed-by Anshuman Khandual <[email protected]>
Signature · 2 lines
Oscar Salvador SUSE Labs