mm/page_alloc: simplify free_page_is_bad by removing free_page_is_bad_report
Refactor free_page_is_bad() to call bad_page() directly, removing the intermediate free_page_is_bad_report(). This reduces unnecessary indirection, improving code clarity and maintainability without changing functionality. Link: https://lkml.kernel.org/r/20250328012031.1204993-1-ye.liu@linux.dev Signed-off-by: Ye Liu <liuye@kylinos.cn> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Reviewed-by: Oscar Salvador <osalvador@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
+1
-7
@@ -934,19 +934,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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user