Skip to content

Commit

Permalink
hexagon/mm/vm_fault.c: Port OOM changes to do_page_fault
Browse files Browse the repository at this point in the history
Commit d065bd8
(mm: retry page fault when blocking on disk transfer) and
commit 37b23e0
(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>
Signed-off-by: Richard Kuo <rkuo@codeaurora.org>
  • Loading branch information
Kautuk Consul authored and Richard Kuo committed May 22, 2012
1 parent 222c547 commit 393a86a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions arch/hexagon/mm/vm_fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -96,14 +99,23 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
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;
Expand Down

0 comments on commit 393a86a

Please sign in to comment.