[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220218094242.2056346-1-luofei@unicloud.com>
Date: Fri, 18 Feb 2022 04:42:42 -0500
From: luofei <luofei@...cloud.com>
To: <naoya.horiguchi@....com>, <akpm@...ux-foundation.org>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
luofei <luofei@...cloud.com>
Subject: [PATCH v3 2/2] hw/poison: Add in-use hugepage hwpoison filter judgement
After successfully obtaining the reference count of the huge
page, it is still necessary to call hwpoison_filter() to make a
filter judgement, otherwise the filter hugepage will be unmaped
and the related process may be killed.
Signed-off-by: luofei <luofei@...cloud.com>
---
mm/memory-failure.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 59d6d939a752..17a7b0a94ab9 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1548,6 +1548,17 @@ static int memory_failure_hugetlb(unsigned long pfn, int flags)
lock_page(head);
page_flags = head->flags;
+ if (hwpoison_filter(p)) {
+ if (TestClearPageHWPoison(head))
+ num_poisoned_pages_dec();
+ put_page(p);
+ if (flags & MF_MCE_HANDLE)
+ res = -EHWPOISON;
+ else
+ res = 0;
+ goto out;
+ }
+
/*
* TODO: hwpoison for pud-sized hugetlb doesn't work right now, so
* simply disable it. In order to make it work properly, we need
--
2.27.0
Powered by blists - more mailing lists