linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: luofei <luofei@unicloud.com>, <naoya.horiguchi@nec.com>,
	<akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 2/2] mm/hwpoison: Add in-use hugepage hwpoison filter judgement
Date: Mon, 21 Feb 2022 20:05:28 +0800	[thread overview]
Message-ID: <8d4e62ad-1084-6fb6-0b56-6149ee44a960@huawei.com> (raw)
In-Reply-To: <20220221021521.2329075-1-luofei@unicloud.com>

On 2022/2/21 10:15, 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.
> 

LGTM. Thanks.

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

BTW: It seems there is also another missing call to hwpoison_filter() when we
encounter free_buddy_page in memory_failure(). But I'am not sure.

> 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
> 



      reply	other threads:[~2022-02-21 12:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21  2:15 luofei
2022-02-21 12:05 ` Miaohe Lin [this message]

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=8d4e62ad-1084-6fb6-0b56-6149ee44a960@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luofei@unicloud.com \
    --cc=naoya.horiguchi@nec.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox