During VM oom condition, kill all threads in process group
We have had complaints where a threaded application is left in a bad state after one of it's threads is killed when we hit a VM: out_of_memory condition. Killing just one of the process threads can leave the application in a bad state, whereas killing the entire process group would allow for the application to restart, or be otherwise handled, and makes it very obvious that something has gone wrong. This change allows the entire process group to be taken down, rather than just the one thread. Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Ian Molton <spyro@f2s.com> Cc: Haavard Skinnemoen <hskinnemoen@atmel.com> Cc: Mikael Starvik <starvik@axis.com> Cc: David Howells <dhowells@redhat.com> Cc: Andi Kleen <ak@suse.de> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Hirokazu Takata <takata@linux-m32r.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Matthew Wilcox <willy@debian.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp> Cc: Richard Curnow <rc@rc0.org.uk> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Chris Zankel <chris@zankel.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
1cd7daa51b
commit
dcca2bde4f
|
@ -197,7 +197,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
|
|||
current->comm, current->pid);
|
||||
if (!user_mode(regs))
|
||||
goto no_context;
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
|
||||
do_sigbus:
|
||||
/* Send a sigbus, regardless of whether we were in kernel
|
||||
|
|
|
@ -266,7 +266,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
|
|||
* the page fault gracefully.
|
||||
*/
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
return 0;
|
||||
}
|
||||
if (fault & VM_FAULT_SIGBUS) {
|
||||
|
|
|
@ -216,7 +216,7 @@ out_of_memory:
|
|||
}
|
||||
printk("VM: Killing process %s\n", tsk->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -360,7 +360,7 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
|
|||
up_read(&mm->mmap_sem);
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -259,7 +259,7 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear
|
|||
up_read(&mm->mmap_sem);
|
||||
printk("VM: killing process %s\n", current->comm);
|
||||
if (user_mode(__frame))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -281,6 +281,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
|
|||
}
|
||||
printk(KERN_CRIT "VM: killing process %s\n", current->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ out_of_memory:
|
|||
}
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
if (error_code & ACE_USERMODE)
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -188,7 +188,7 @@ out_of_memory:
|
|||
|
||||
printk("VM: killing process %s\n", current->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
|
||||
no_context:
|
||||
current->thread.signo = SIGBUS;
|
||||
|
|
|
@ -180,7 +180,7 @@ out_of_memory:
|
|||
}
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -263,6 +263,6 @@ no_context:
|
|||
up_read(&mm->mmap_sem);
|
||||
printk(KERN_CRIT "VM: killing process %s\n", current->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ out_of_memory:
|
|||
}
|
||||
printk("VM: killing process %s\n", current->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
return SIGKILL;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -218,7 +218,7 @@ static int do_out_of_memory(struct pt_regs *regs, unsigned long error_code,
|
|||
}
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
if (regs->psw.mask & PSW_MASK_PSTATE)
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
do_no_context(regs, error_code, address);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ out_of_memory:
|
|||
}
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -334,7 +334,7 @@ out_of_memory:
|
|||
}
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -369,7 +369,7 @@ out_of_memory:
|
|||
up_read(&mm->mmap_sem);
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
if (from_user)
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -463,7 +463,7 @@ out_of_memory:
|
|||
up_read(&mm->mmap_sem);
|
||||
printk("VM: killing process %s\n", current->comm);
|
||||
if (!(regs->tstate & TSTATE_PRIV))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto handle_kernel_fault;
|
||||
|
||||
intr_or_no_mm:
|
||||
|
|
|
@ -593,7 +593,7 @@ out_of_memory:
|
|||
}
|
||||
printk("VM: killing process %s\n", tsk->comm);
|
||||
if (error_code & 4)
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
goto no_context;
|
||||
|
||||
do_sigbus:
|
||||
|
|
|
@ -152,7 +152,7 @@ out_of_memory:
|
|||
}
|
||||
printk("VM: killing process %s\n", current->comm);
|
||||
if (user_mode(regs))
|
||||
do_exit(SIGKILL);
|
||||
do_group_exit(SIGKILL);
|
||||
bad_page_fault(regs, address, SIGKILL);
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue