linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Zhou Guanghui <zhouguanghui1@huawei.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm/huge_memory: Return from zap_huge_pmd after WARN_ONCE.
Date: Fri, 15 Jul 2022 18:50:36 +0100	[thread overview]
Message-ID: <YtGo7GS5l4WxZA/R@casper.infradead.org> (raw)
In-Reply-To: <20220715092238.22663-1-zhouguanghui1@huawei.com>

On Fri, Jul 15, 2022 at 09:22:38AM +0000, Zhou Guanghui wrote:
> After WARN_ONCE is processed, the subsequent page judgment results
> in NULL pointer access. It is more reasonable to return from the
> function here.

I'm not sure this is a good idea.  Probably better to crash than
continue.

> Signed-off-by: Zhou Guanghui <zhouguanghui1@huawei.com>
> ---
>  mm/huge_memory.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 834f288b3769..7f5ccca6792a 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1601,8 +1601,11 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
>  			entry = pmd_to_swp_entry(orig_pmd);
>  			page = pfn_swap_entry_to_page(entry);
>  			flush_needed = 0;
> -		} else
> +		} else {
> +			spin_unlock(ptl);
>  			WARN_ONCE(1, "Non present huge pmd without pmd migration enabled!");
> +			return 1;
> +		}
>  
>  		if (PageAnon(page)) {
>  			zap_deposited_table(tlb->mm, pmd);
> -- 
> 2.17.1
> 
> 


  reply	other threads:[~2022-07-15 17:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15  9:22 Zhou Guanghui
2022-07-15 17:50 ` Matthew Wilcox [this message]
2022-07-18  6:49   ` Zhou Guanghui

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=YtGo7GS5l4WxZA/R@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zhouguanghui1@huawei.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