linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Nadav Amit <nadav.amit@gmail.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Axel Rasmussen <axelrasmussen@google.com>,
	Mike Rapoport <rppt@linux.vnet.ibm.com>
Subject: Re: [PATCH v2 2/3] mm/hugetlb: Use hugetlb_pte_stable in migration race check
Date: Mon, 3 Oct 2022 19:35:05 -0700	[thread overview]
Message-ID: <Yzub2QMyZxCLHPpA@monkey> (raw)
In-Reply-To: <20221004003705.497782-3-peterx@redhat.com>

On 10/03/22 20:37, Peter Xu wrote:
> After hugetlb_pte_stable() introduced, we can also rewrite the migration
> race condition against page allocation to use the new helper too.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  mm/hugetlb.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
-- 
Mike Kravetz

> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index fa3fcdb0c4b8..e762c5369a6f 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -5620,11 +5620,10 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
>  			 * here.  Before returning error, get ptl and make
>  			 * sure there really is no pte entry.
>  			 */
> -			ptl = huge_pte_lock(h, mm, ptep);
> -			ret = 0;
> -			if (huge_pte_none(huge_ptep_get(ptep)))
> +			if (hugetlb_pte_stable(h, mm, ptep, old_pte))
>  				ret = vmf_error(PTR_ERR(page));
> -			spin_unlock(ptl);
> +			else
> +				ret = 0;
>  			goto out;
>  		}
>  		clear_huge_page(page, address, pages_per_huge_page(h));
> -- 
> 2.37.3
> 


  reply	other threads:[~2022-10-04  2:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04  0:37 [PATCH v2 0/3] mm/hugetlb: Fix selftest failures with write check Peter Xu
2022-10-04  0:37 ` [PATCH v2 1/3] mm/hugetlb: Fix race condition of uffd missing/minor handling Peter Xu
2022-10-04  2:32   ` Mike Kravetz
2022-10-04 13:53     ` Peter Xu
2022-10-04 12:19   ` David Hildenbrand
2022-10-04 13:49     ` Peter Xu
2022-10-04  0:37 ` [PATCH v2 2/3] mm/hugetlb: Use hugetlb_pte_stable in migration race check Peter Xu
2022-10-04  2:35   ` Mike Kravetz [this message]
2022-10-04 12:20   ` David Hildenbrand
2022-10-04  0:37 ` [PATCH v2 3/3] mm/selftest: uffd: Explain the write missing fault check Peter Xu
2022-10-04  2:37   ` Mike Kravetz
2022-10-04 12:20   ` David Hildenbrand

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=Yzub2QMyZxCLHPpA@monkey \
    --to=mike.kravetz@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nadav.amit@gmail.com \
    --cc=peterx@redhat.com \
    --cc=rppt@linux.vnet.ibm.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