[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200411220357.9636-2-richard.weiyang@gmail.com>
Date: Sat, 11 Apr 2020 22:03:53 +0000
From: Wei Yang <richard.weiyang@...il.com>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
rientjes@...gle.com, anshuman.khandual@....com, david@...hat.com,
Wei Yang <richard.weiyang@...il.com>
Subject: [Patch v3 1/5] mm/page_alloc.c: bad_[reason|flags] is not necessary when PageHWPoison
Since function returns directly, bad_[reason|flags] is not used any
where. And move this to the first.
This is a following cleanup for commit e570f56cccd21 ("mm:
check_new_page_bad() directly returns in __PG_HWPOISON case")
Signed-off-by: Wei Yang <richard.weiyang@...il.com>
Acked-by: Michal Hocko <mhocko@...e.com>
Reviewed-by: David Hildenbrand <david@...hat.com>
---
v3:
* move this handling to the first case
---
mm/page_alloc.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f49f28f1220b..7327dc039069 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2037,19 +2037,17 @@ static void check_new_page_bad(struct page *page)
const char *bad_reason = NULL;
unsigned long bad_flags = 0;
+ if (unlikely(page->flags & __PG_HWPOISON)) {
+ /* Don't complain about hwpoisoned pages */
+ page_mapcount_reset(page); /* remove PageBuddy */
+ return;
+ }
if (unlikely(atomic_read(&page->_mapcount) != -1))
bad_reason = "nonzero mapcount";
if (unlikely(page->mapping != NULL))
bad_reason = "non-NULL mapping";
if (unlikely(page_ref_count(page) != 0))
bad_reason = "nonzero _refcount";
- if (unlikely(page->flags & __PG_HWPOISON)) {
- bad_reason = "HWPoisoned (hardware-corrupted)";
- bad_flags = __PG_HWPOISON;
- /* Don't complain about hwpoisoned pages */
- page_mapcount_reset(page); /* remove PageBuddy */
- return;
- }
if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) {
bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set";
bad_flags = PAGE_FLAGS_CHECK_AT_PREP;
--
2.23.0
Powered by blists - more mailing lists