linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 11/20] hexagon/mm/vm_fault.c: Port OOM changes to do_page_fault
@ 2012-03-20 13:23 Kautuk Consul
  2012-03-27 16:42 ` Richard Kuo
  0 siblings, 1 reply; 3+ messages in thread
From: Kautuk Consul @ 2012-03-20 13:23 UTC (permalink / raw)
  To: Richard Kuo, Linas Vepstas, Arnd Bergmann
  Cc: linux-hexagon, linux-kernel, Kautuk Consul

Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
(mm: retry page fault when blocking on disk transfer) and
commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
(x86,mm: make pagefault killable)

The above commits introduced changes into the x86 pagefault handler
for making the page fault handler retryable as well as killable.

These changes reduce the mmap_sem hold time, which is crucial
during OOM killer invocation.

Port these changes to hexagon.

Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
---
 arch/hexagon/mm/vm_fault.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/hexagon/mm/vm_fault.c b/arch/hexagon/mm/vm_fault.c
index c10b76f..06695cc 100644
--- a/arch/hexagon/mm/vm_fault.c
+++ b/arch/hexagon/mm/vm_fault.c
@@ -53,6 +53,8 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
 	int si_code = SEGV_MAPERR;
 	int fault;
 	const struct exception_table_entry *fixup;
+	unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
+				 (cause > 0 ? FAULT_FLAG_WRITE : 0);
 
 	/*
 	 * If we're in an interrupt or have no user context,
@@ -63,6 +65,7 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
 
 	local_irq_enable();
 
+retry:
 	down_read(&mm->mmap_sem);
 	vma = find_vma(mm, address);
 	if (!vma)
@@ -96,14 +99,23 @@ good_area:
 		break;
 	}
 
-	fault = handle_mm_fault(mm, vma, address, (cause > 0));
+	fault = handle_mm_fault(mm, vma, address, flags);
+
+	if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+		return;
 
 	/* The most common case -- we are done. */
 	if (likely(!(fault & VM_FAULT_ERROR))) {
-		if (fault & VM_FAULT_MAJOR)
-			current->maj_flt++;
-		else
-			current->min_flt++;
+		if (flags & FAULT_FLAG_ALLOW_RETRY) {
+			if (fault & VM_FAULT_MAJOR)
+				current->maj_flt++;
+			else
+				current->min_flt++;
+			if (fault & VM_FAULT_RETRY) {
+				flags &= ~FAULT_FLAG_ALLOW_RETRY;
+				goto retry;
+			}
+		}
 
 		up_read(&mm->mmap_sem);
 		return;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 11/20] hexagon/mm/vm_fault.c: Port OOM changes to do_page_fault
  2012-03-20 13:23 [PATCH 11/20] hexagon/mm/vm_fault.c: Port OOM changes to do_page_fault Kautuk Consul
@ 2012-03-27 16:42 ` Richard Kuo
  2012-03-31 10:11   ` Kautuk Consul
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Kuo @ 2012-03-27 16:42 UTC (permalink / raw)
  To: Kautuk Consul; +Cc: Linas Vepstas, Arnd Bergmann, linux-hexagon, linux-kernel

On Tue, Mar 20, 2012 at 09:23:33AM -0400, Kautuk Consul wrote:
> Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
> (mm: retry page fault when blocking on disk transfer) and
> commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
> (x86,mm: make pagefault killable)
> 
> The above commits introduced changes into the x86 pagefault handler
> for making the page fault handler retryable as well as killable.
> 
> These changes reduce the mmap_sem hold time, which is crucial
> during OOM killer invocation.
> 
> Port these changes to hexagon.
> 
> Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
> ---
>  arch/hexagon/mm/vm_fault.c |   22 +++++++++++++++++-----
>  1 files changed, 17 insertions(+), 5 deletions(-)
> 

Sorry for the delay; got around to it this morning.  Looks good; thanks!

Acked-by: Richard Kuo <rkuo@codeaurora.org>


-- 

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 11/20] hexagon/mm/vm_fault.c: Port OOM changes to do_page_fault
  2012-03-27 16:42 ` Richard Kuo
@ 2012-03-31 10:11   ` Kautuk Consul
  0 siblings, 0 replies; 3+ messages in thread
From: Kautuk Consul @ 2012-03-31 10:11 UTC (permalink / raw)
  To: Richard Kuo; +Cc: Linas Vepstas, Arnd Bergmann, linux-hexagon, linux-kernel

>
> Sorry for the delay; got around to it this morning.  Looks good; thanks!
>

No problem at all.

> Acked-by: Richard Kuo <rkuo@codeaurora.org>
>

And thanks for the ACK.

>
> --
>
> Sent by an employee of the Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-31 10:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-20 13:23 [PATCH 11/20] hexagon/mm/vm_fault.c: Port OOM changes to do_page_fault Kautuk Consul
2012-03-27 16:42 ` Richard Kuo
2012-03-31 10:11   ` Kautuk Consul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).