From: Ye Liu <ye.liu@linux.dev>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Ye Liu <liuye@kylinos.cn>
Subject: [PATCH] mm/page_alloc: Simplify free_page_is_bad by removing free_page_is_bad_report
Date: Fri, 21 Mar 2025 09:07:10 +0800 [thread overview]
Message-ID: <20250321010710.548105-1-ye.liu@linux.dev> (raw)
From: Ye Liu <liuye@kylinos.cn>
This patch 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.
Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
mm/page_alloc.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 61d6a3b1b286..2842da893eea 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -933,19 +933,14 @@ 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;
}
--
2.25.1
next reply other threads:[~2025-03-21 1:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 1:07 Ye Liu [this message]
2025-03-21 4:39 ` [PATCH] mm/page_alloc: Simplify free_page_is_bad by removing free_page_is_bad_report Anshuman Khandual
2025-03-21 6:09 ` Ye Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250321010710.548105-1-ye.liu@linux.dev \
--to=ye.liu@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuye@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.