linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Mike Rapoport <rppt@linux.vnet.ibm.com>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH 1/1] mm/hugetlb.c: teach follow_hugetlb_page() to handle FOLL_NOWAIT
Date: Wed, 9 Jan 2019 13:05:05 +0800	[thread overview]
Message-ID: <20190109050505.GC12837@xz-x1> (raw)
In-Reply-To: <20190109020203.26669-2-aarcange@redhat.com>

On Tue, Jan 08, 2019 at 09:02:03PM -0500, Andrea Arcangeli wrote:
> hugetlb needs the same fix as faultin_nopage (which was applied in
> 96312e61282ae3f6537a562625706498cbc75594) or KVM hangs because it
> thinks the mmap_sem was already released by hugetlb_fault() if it
> returned VM_FAULT_RETRY, but it wasn't in the FOLL_NOWAIT case.
> 
> Fixes: ce53053ce378 ("kvm: switch get_user_page_nowait() to get_user_pages_unlocked()")
> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
> Tested-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Reported-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

FWIW:

Reviewed-by: Peter Xu <peterx@redhat.com>

> ---
>  mm/hugetlb.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index e37efd5d8318..b3622d7888c8 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4301,7 +4301,8 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
>  				break;
>  			}
>  			if (ret & VM_FAULT_RETRY) {
> -				if (nonblocking)
> +				if (nonblocking &&
> +				    !(fault_flags & FAULT_FLAG_RETRY_NOWAIT))
>  					*nonblocking = 0;
>  				*nr_pages = 0;
>  				/*

Regards,

-- 
Peter Xu

      parent reply	other threads:[~2019-01-09  5:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09  2:02 [PATCH 0/1] " Andrea Arcangeli
2019-01-09  2:02 ` [PATCH 1/1] " Andrea Arcangeli
2019-01-09  2:53   ` Mike Kravetz
2019-01-09  5:05   ` Peter Xu [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=20190109050505.GC12837@xz-x1 \
    --to=peterx@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dgilbert@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.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