linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 2/2] hw/poison: Add in-use hugepage hwpoison filter judgement
@ 2022-02-18  9:42 luofei
  2022-02-21  1:32 ` HORIGUCHI NAOYA(堀口 直也)
  0 siblings, 1 reply; 2+ messages in thread
From: luofei @ 2022-02-18  9:42 UTC (permalink / raw)
  To: naoya.horiguchi, akpm; +Cc: linux-mm, linux-kernel, luofei

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@unicloud.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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v3 2/2] hw/poison: Add in-use hugepage hwpoison filter judgement
  2022-02-18  9:42 [PATCH v3 2/2] hw/poison: Add in-use hugepage hwpoison filter judgement luofei
@ 2022-02-21  1:32 ` HORIGUCHI NAOYA(堀口 直也)
  0 siblings, 0 replies; 2+ messages in thread
From: HORIGUCHI NAOYA(堀口 直也) @ 2022-02-21  1:32 UTC (permalink / raw)
  To: luofei; +Cc: akpm, linux-mm, linux-kernel

# please update "hw/poison" as well.

On Fri, Feb 18, 2022 at 04:42:42AM -0500, luofei wrote:
> 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@unicloud.com>

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-21  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18  9:42 [PATCH v3 2/2] hw/poison: Add in-use hugepage hwpoison filter judgement luofei
2022-02-21  1:32 ` HORIGUCHI NAOYA(堀口 直也)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox