aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/fault.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/mm/fault.c')
-rw-r--r--arch/x86/mm/fault.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 8e13ecb41bee..027088f2f7dd 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -18,7 +18,7 @@
18#include <asm/pgalloc.h> /* pgd_*(), ... */ 18#include <asm/pgalloc.h> /* pgd_*(), ... */
19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ 19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
20#include <asm/fixmap.h> /* VSYSCALL_START */ 20#include <asm/fixmap.h> /* VSYSCALL_START */
21#include <asm/rcu.h> /* exception_enter(), ... */ 21#include <asm/context_tracking.h> /* exception_enter(), ... */
22 22
23/* 23/*
24 * Page fault error code bits: 24 * Page fault error code bits:
@@ -803,20 +803,6 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
803 __bad_area(regs, error_code, address, SEGV_ACCERR); 803 __bad_area(regs, error_code, address, SEGV_ACCERR);
804} 804}
805 805
806/* TODO: fixup for "mm-invoke-oom-killer-from-page-fault.patch" */
807static void
808out_of_memory(struct pt_regs *regs, unsigned long error_code,
809 unsigned long address)
810{
811 /*
812 * We ran out of memory, call the OOM killer, and return the userspace
813 * (which will retry the fault, or kill us if we got oom-killed):
814 */
815 up_read(&current->mm->mmap_sem);
816
817 pagefault_out_of_memory();
818}
819
820static void 806static void
821do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, 807do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
822 unsigned int fault) 808 unsigned int fault)
@@ -879,7 +865,14 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
879 return 1; 865 return 1;
880 } 866 }
881 867
882 out_of_memory(regs, error_code, address); 868 up_read(&current->mm->mmap_sem);
869
870 /*
871 * We ran out of memory, call the OOM killer, and return the
872 * userspace (which will retry the fault, or kill us if we got
873 * oom-killed):
874 */
875 pagefault_out_of_memory();
883 } else { 876 } else {
884 if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON| 877 if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
885 VM_FAULT_HWPOISON_LARGE)) 878 VM_FAULT_HWPOISON_LARGE))