Skip to content

Commit dcca2bd

Browse files
willschmLinus Torvalds
authored andcommitted
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>
1 parent 1cd7daa commit dcca2bd

18 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎arch/alpha/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
197197
current->comm, current->pid);
198198
if (!user_mode(regs))
199199
goto no_context;
200-
do_exit(SIGKILL);
200+
do_group_exit(SIGKILL);
201201

202202
do_sigbus:
203203
/* Send a sigbus, regardless of whether we were in kernel

‎arch/arm/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
266266
* the page fault gracefully.
267267
*/
268268
printk("VM: killing process %s\n", tsk->comm);
269-
do_exit(SIGKILL);
269+
do_group_exit(SIGKILL);
270270
return 0;
271271
}
272272
if (fault & VM_FAULT_SIGBUS) {

‎arch/avr32/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ asmlinkage void do_page_fault(unsigned long ecr, struct pt_regs *regs)
216216
}
217217
printk("VM: Killing process %s\n", tsk->comm);
218218
if (user_mode(regs))
219-
do_exit(SIGKILL);
219+
do_group_exit(SIGKILL);
220220
goto no_context;
221221

222222
do_sigbus:

‎arch/cris/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
360360
up_read(&mm->mmap_sem);
361361
printk("VM: killing process %s\n", tsk->comm);
362362
if (user_mode(regs))
363-
do_exit(SIGKILL);
363+
do_group_exit(SIGKILL);
364364
goto no_context;
365365

366366
do_sigbus:

‎arch/frv/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear
259259
up_read(&mm->mmap_sem);
260260
printk("VM: killing process %s\n", current->comm);
261261
if (user_mode(__frame))
262-
do_exit(SIGKILL);
262+
do_group_exit(SIGKILL);
263263
goto no_context;
264264

265265
do_sigbus:

‎arch/ia64/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
281281
}
282282
printk(KERN_CRIT "VM: killing process %s\n", current->comm);
283283
if (user_mode(regs))
284-
do_exit(SIGKILL);
284+
do_group_exit(SIGKILL);
285285
goto no_context;
286286
}

‎arch/m32r/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
278278
}
279279
printk("VM: killing process %s\n", tsk->comm);
280280
if (error_code & ACE_USERMODE)
281-
do_exit(SIGKILL);
281+
do_group_exit(SIGKILL);
282282
goto no_context;
283283

284284
do_sigbus:

‎arch/m68k/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
188188

189189
printk("VM: killing process %s\n", current->comm);
190190
if (user_mode(regs))
191-
do_exit(SIGKILL);
191+
do_group_exit(SIGKILL);
192192

193193
no_context:
194194
current->thread.signo = SIGBUS;

‎arch/mips/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
180180
}
181181
printk("VM: killing process %s\n", tsk->comm);
182182
if (user_mode(regs))
183-
do_exit(SIGKILL);
183+
do_group_exit(SIGKILL);
184184
goto no_context;
185185

186186
do_sigbus:

‎arch/parisc/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
263263
up_read(&mm->mmap_sem);
264264
printk(KERN_CRIT "VM: killing process %s\n", current->comm);
265265
if (user_mode(regs))
266-
do_exit(SIGKILL);
266+
do_group_exit(SIGKILL);
267267
goto no_context;
268268
}

0 commit comments

Comments
 (0)