linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zach O'Keefe <zokeefe@google.com>
To: Yang Shi <shy828301@gmail.com>
Cc: vbabka@suse.cz, kirill.shutemov@linux.intel.com,
	willy@infradead.org, linmiaohe@huawei.com,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [v4 PATCH 3/7] mm: khugepaged: better comments for anon vma check in hugepage_vma_revalidate
Date: Wed, 15 Jun 2022 16:57:40 -0700	[thread overview]
Message-ID: <Yqpx9D6blRSuIL2K@google.com> (raw)
In-Reply-To: <20220615172926.546974-4-shy828301@gmail.com>

On 15 Jun 10:29, Yang Shi wrote:
> The hugepage_vma_revalidate() needs to check if the vma is still
> anonymous vma or not since the address may be unmapped then remapped to
> file before khugepaged reaquired the mmap_lock.
> 
> The old comment is not quite helpful, elaborate this with better
> comment.
> 
> Signed-off-by: Yang Shi <shy828301@gmail.com>
> ---
>  mm/khugepaged.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index db0b334a7d1f..5baa394e34c8 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -960,7 +960,13 @@ static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address,
>  		return SCAN_ADDRESS_RANGE;
>  	if (!hugepage_vma_check(vma, vma->vm_flags))
>  		return SCAN_VMA_CHECK;
> -	/* Anon VMA expected */
> +	/*
> +	 * Anon VMA expected, the address may be unmapped then
> +	 * remapped to file after khugepaged reaquired the mmap_lock.
> +	 *
> +	 * hugepage_vma_check may return true for qualified file
> +	 * vmas.
> +	 */
>  	if (!vma->anon_vma || !vma_is_anonymous(vma))
>  		return SCAN_VMA_CHECK;
>  	return 0;
> -- 
> 2.26.3
> 

Reviewed-by: Zach O'Keefe <zokeefe@google.com>


  reply	other threads:[~2022-06-15 23:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 17:29 [mm-unstable v4 PATCH 0/7] Cleanup transhuge_xxx helpers Yang Shi
2022-06-15 17:29 ` [v4 PATCH 1/7] mm: khugepaged: check THP flag in hugepage_vma_check() Yang Shi
2022-06-15 17:29 ` [v4 PATCH 2/7] mm: thp: consolidate vma size check to transhuge_vma_suitable Yang Shi
2022-06-15 23:55   ` Zach O'Keefe
2022-06-15 17:29 ` [v4 PATCH 3/7] mm: khugepaged: better comments for anon vma check in hugepage_vma_revalidate Yang Shi
2022-06-15 23:57   ` Zach O'Keefe [this message]
2022-06-15 17:29 ` [v4 PATCH 4/7] mm: thp: kill transparent_hugepage_active() Yang Shi
2022-06-16  0:17   ` Zach O'Keefe
2022-06-16  0:32     ` Yang Shi
2022-06-15 17:29 ` [v4 PATCH 5/7] mm: thp: kill __transhuge_page_enabled() Yang Shi
2022-06-16  0:56   ` Zach O'Keefe
2022-06-15 17:29 ` [v4 PATCH 6/7] mm: khugepaged: reorg some khugepaged helpers Yang Shi
2022-06-16  0:27   ` Zach O'Keefe
2022-06-15 17:29 ` [v4 PATCH 7/7] doc: proc: fix the description to THPeligible Yang Shi
2022-06-16  0:20   ` Zach O'Keefe

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=Yqpx9D6blRSuIL2K@google.com \
    --to=zokeefe@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /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