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>
This commit is contained in:
@@ -671,7 +671,8 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
|
|||||||
goto bad_area_nosemaphore;
|
goto bad_area_nosemaphore;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
/* When running in the kernel we expect faults to occur only to
|
/*
|
||||||
|
* When running in the kernel we expect faults to occur only to
|
||||||
* addresses in user space. All other faults represent errors in the
|
* addresses in user space. All other faults represent errors in the
|
||||||
* kernel and should generate an OOPS. Unfortunately, in the case of an
|
* kernel and should generate an OOPS. Unfortunately, in the case of an
|
||||||
* erroneous fault occurring in a code path which already holds mmap_sem
|
* erroneous fault occurring in a code path which already holds mmap_sem
|
||||||
@@ -734,9 +735,6 @@ good_area:
|
|||||||
goto bad_area;
|
goto bad_area;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
|
||||||
survive:
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* If for any reason at all we couldn't handle the fault,
|
* If for any reason at all we couldn't handle the fault,
|
||||||
* make sure we exit gracefully rather than endlessly redo
|
* make sure we exit gracefully rather than endlessly redo
|
||||||
@@ -871,12 +869,11 @@ out_of_memory:
|
|||||||
up_read(&mm->mmap_sem);
|
up_read(&mm->mmap_sem);
|
||||||
if (is_global_init(tsk)) {
|
if (is_global_init(tsk)) {
|
||||||
yield();
|
yield();
|
||||||
#ifdef CONFIG_X86_32
|
/*
|
||||||
down_read(&mm->mmap_sem);
|
* Re-lookup the vma - in theory the vma tree might
|
||||||
goto survive;
|
* have changed:
|
||||||
#else
|
*/
|
||||||
goto again;
|
goto again;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("VM: killing process %s\n", tsk->comm);
|
printk("VM: killing process %s\n", tsk->comm);
|
||||||
|
Reference in New Issue
Block a user