提交 a06ad3c0 编写于 作者: L luofei 提交者: Linus Torvalds

mm/hwpoison: 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.

Link: https://lkml.kernel.org/r/20220223082254.2769757-1-luofei@unicloud.comSigned-off-by: Nluofei <luofei@unicloud.com>
Reviewed-by: NMiaohe Lin <linmiaohe@huawei.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 d1fe111f
...@@ -1534,6 +1534,14 @@ static int memory_failure_hugetlb(unsigned long pfn, int flags) ...@@ -1534,6 +1534,14 @@ static int memory_failure_hugetlb(unsigned long pfn, int flags)
lock_page(head); lock_page(head);
page_flags = head->flags; page_flags = head->flags;
if (hwpoison_filter(p)) {
if (TestClearPageHWPoison(head))
num_poisoned_pages_dec();
put_page(p);
res = -EOPNOTSUPP;
goto out;
}
/* /*
* TODO: hwpoison for pud-sized hugetlb doesn't work right now, so * TODO: hwpoison for pud-sized hugetlb doesn't work right now, so
* simply disable it. In order to make it work properly, we need * simply disable it. In order to make it work properly, we need
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册