diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-13 11:49:02 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-13 12:11:13 -0400 |
commit | 3a1dfe6eefe483589c99c909202ffe1a20d589b5 (patch) | |
tree | 9c7bf05694b62a021ad87f7c36c28f77910e3c70 /arch/x86/mm/fault.c | |
parent | 891cffbd6bcba26409869c19c07ecd4bfc0c2460 (diff) |
x86/mm: unify init task OOM handling
Linus noticed that the "again:" versus "survive:" OOM logic for
the init task was arbitrarily different.
The 64-bit codepath is the better one, because it correctly re-lookups
the vma after having dropped the ->mmap_sem.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/mm/fault.c')
-rw-r--r-- | arch/x86/mm/fault.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index ac2ad781da00..8bc5956e1af4 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -671,7 +671,8 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
671 | goto bad_area_nosemaphore; | 671 | goto bad_area_nosemaphore; |
672 | 672 | ||
673 | again: | 673 | again: |
674 | /* When running in the kernel we expect faults to occur only to | 674 | /* |
675 | * When running in the kernel we expect faults to occur only to | ||
675 | * addresses in user space. All other faults represent errors in the | 676 | * addresses in user space. All other faults represent errors in the |
676 | * kernel and should generate an OOPS. Unfortunately, in the case of an | 677 | * kernel and should generate an OOPS. Unfortunately, in the case of an |
677 | * erroneous fault occurring in a code path which already holds mmap_sem | 678 | * erroneous fault occurring in a code path which already holds mmap_sem |
@@ -734,9 +735,6 @@ good_area: | |||
734 | goto bad_area; | 735 | goto bad_area; |
735 | } | 736 | } |
736 | 737 | ||
737 | #ifdef CONFIG_X86_32 | ||
738 | survive: | ||
739 | #endif | ||
740 | /* | 738 | /* |
741 | * If for any reason at all we couldn't handle the fault, | 739 | * If for any reason at all we couldn't handle the fault, |
742 | * make sure we exit gracefully rather than endlessly redo | 740 | * make sure we exit gracefully rather than endlessly redo |
@@ -871,12 +869,11 @@ out_of_memory: | |||
871 | up_read(&mm->mmap_sem); | 869 | up_read(&mm->mmap_sem); |
872 | if (is_global_init(tsk)) { | 870 | if (is_global_init(tsk)) { |
873 | yield(); | 871 | yield(); |
874 | #ifdef CONFIG_X86_32 | 872 | /* |
875 | down_read(&mm->mmap_sem); | 873 | * Re-lookup the vma - in theory the vma tree might |
876 | goto survive; | 874 | * have changed: |
877 | #else | 875 | */ |
878 | goto again; | 876 | goto again; |
879 | #endif | ||
880 | } | 877 | } |
881 | 878 | ||
882 | printk("VM: killing process %s\n", tsk->comm); | 879 | printk("VM: killing process %s\n", tsk->comm); |