Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: invoke oom-killer from page fault

As explained in commit 1c0fe6e3bd ("mm: invoke oom-killer from page
fault") , we want to call the architecture independent oom killer when
getting an unexplained OOM from handle_mm_fault, rather than simply
killing current.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Nick Piggin and committed by
Linus Torvalds
f76f5d71 c421b08e

+4 -10
+4 -10
arch/xtensa/mm/fault.c
··· 105 105 * make sure we exit gracefully rather than endlessly redo 106 106 * the fault. 107 107 */ 108 - survive: 109 108 fault = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0); 110 109 if (unlikely(fault & VM_FAULT_ERROR)) { 111 110 if (fault & VM_FAULT_OOM) ··· 145 146 */ 146 147 out_of_memory: 147 148 up_read(&mm->mmap_sem); 148 - if (is_global_init(current)) { 149 - yield(); 150 - down_read(&mm->mmap_sem); 151 - goto survive; 152 - } 153 - printk("VM: killing process %s\n", current->comm); 154 - if (user_mode(regs)) 155 - do_group_exit(SIGKILL); 156 - bad_page_fault(regs, address, SIGKILL); 149 + if (!user_mode(regs)) 150 + bad_page_fault(regs, address, SIGKILL); 151 + else 152 + pagefault_out_of_memory(); 157 153 return; 158 154 159 155 do_sigbus: