All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>,
	mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
	bsingharora@gmail.com, npiggin@gmail.com
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] powerpc/mm: move mmap_sem unlocking in do_page_fault()
Date: Tue, 21 Mar 2017 14:42:25 +0530	[thread overview]
Message-ID: <874lynoux2.fsf@skywalker.in.ibm.com> (raw)
In-Reply-To: <6515aebdbd7adad576f1c97753809547b273504a.1487090656.git.ldufour@linux.vnet.ibm.com>

Laurent Dufour <ldufour@linux.vnet.ibm.com> writes:

> Since the fault retry is now handled earlier, we can release the
> mmap_sem lock earlier too and remove later unlocking previously done in
> mm_fault_error().
>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> 


> Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
> ---
>  arch/powerpc/mm/fault.c | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 2a6bc7e6e69a..21e06cce8984 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -151,13 +151,6 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
>  	 * continue the pagefault.
>  	 */
>  	if (fatal_signal_pending(current)) {
> -		/*
> -		 * If we have retry set, the mmap semaphore will have
> -		 * alrady been released in __lock_page_or_retry(). Else
> -		 * we release it now.
> -		 */
> -		if (!(fault & VM_FAULT_RETRY))
> -			up_read(&current->mm->mmap_sem);
>  		/* Coming from kernel, we need to deal with uaccess fixups */
>  		if (user_mode(regs))
>  			return MM_FAULT_RETURN;
> @@ -170,8 +163,6 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
>
>  	/* Out of memory */
>  	if (fault & VM_FAULT_OOM) {
> -		up_read(&current->mm->mmap_sem);
> -
>  		/*
>  		 * We ran out of memory, or some other thing happened to us that
>  		 * made us unable to handle the page fault gracefully.
> @@ -182,10 +173,8 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
>  		return MM_FAULT_RETURN;
>  	}
>
> -	if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
> -		up_read(&current->mm->mmap_sem);
> +	if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE))
>  		return do_sigbus(regs, addr, fault);
> -	}
>
>  	/* We don't understand the fault code, this is fatal */
>  	BUG();
> @@ -452,11 +441,12 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
>  				goto retry;
>  		}
>  		/* We will enter mm_fault_error() below */
> -	}
> +	} else
> +		up_read(&current->mm->mmap_sem);
>
>  	if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) {
>  		if (fault & VM_FAULT_SIGSEGV)
> -			goto bad_area;
> +			goto bad_area_nosemaphore;
>  		rc = mm_fault_error(regs, address, fault);
>  		if (rc >= MM_FAULT_RETURN)
>  			goto bail;
> @@ -488,7 +478,6 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
>  			      regs, address);
>  	}
>
> -	up_read(&mm->mmap_sem);
>  	goto bail;
>
>  bad_area:
> -- 
> 2.7.4

  reply	other threads:[~2017-03-21  9:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 16:45 [PATCH 0/3] powerpc/mm: page fault handler cleaning Laurent Dufour
2017-02-14 16:45 ` [PATCH 1/3] powerpc/mm: move mmap_sem unlock up from do_sigbus Laurent Dufour
2017-03-21  8:39   ` Aneesh Kumar K.V
2017-03-21 11:36   ` [1/3] " Michael Ellerman
2017-02-14 16:45 ` [PATCH 2/3] powerpc/mm: handle VM_FAULT_RETRY earlier Laurent Dufour
2017-03-21  9:12   ` Aneesh Kumar K.V
2017-03-21  9:57     ` Laurent Dufour
2017-02-14 16:45 ` [PATCH 3/3] powerpc/mm: move mmap_sem unlocking in do_page_fault() Laurent Dufour
2017-03-21  9:12   ` Aneesh Kumar K.V [this message]
2017-03-02 12:30 ` [PATCH 0/3] powerpc/mm: page fault handler cleaning Laurent Dufour
2017-03-03 12:17   ` Michael Ellerman

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=874lynoux2.fsf@skywalker.in.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bsingharora@gmail.com \
    --cc=ldufour@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.