diff options
author | Will Schmidt <will_schmidt@vnet.ibm.com> | 2007-10-16 04:24:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:42:52 -0400 |
commit | dcca2bde4f86a14d3291660bede8f1844fe2b3df (patch) | |
tree | 6beef48bb4eb715e091c7db87953328314471886 | |
parent | 1cd7daa51baf0934882bf24a7ae378ec75df665e (diff) |
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>
-rw-r--r-- | arch/alpha/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/avr32/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/cris/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/frv/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/ia64/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/m32r/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/m68k/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/mips/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/parisc/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/ppc/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/s390/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/sh/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/sh64/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/sparc/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/sparc64/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/fault_32.c | 2 | ||||
-rw-r--r-- | arch/xtensa/mm/fault.c | 2 |
18 files changed, 18 insertions, 18 deletions
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c index a0e18da594..25154df305 100644 --- a/arch/alpha/mm/fault.c +++ b/arch/alpha/mm/fault.c | |||
@@ -197,7 +197,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr, | |||
197 | current->comm, current->pid); | 197 | current->comm, current->pid); |
198 | if (!user_mode(regs)) | 198 | if (!user_mode(regs)) |
199 | goto no_context; | 199 | goto no_context; |
200 | do_exit(SIGKILL); | 200 | do_group_exit(SIGKILL); |
201 | 201 | ||
202 | do_sigbus: | 202 | do_sigbus: |
203 | /* Send a sigbus, regardless of whether we were in kernel | 203 | /* Send a sigbus, regardless of whether we were in kernel |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 846cce48e2..59ed1d05b7 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -266,7 +266,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
266 | * the page fault gracefully. | 266 | * the page fault gracefully. |
267 | */ | 267 | */ |
268 | printk("VM: killing process %s\n", tsk->comm); | 268 | printk("VM: killing process %s\n", tsk->comm); |
269 | do_exit(SIGKILL); | 269 | do_group_exit(SIGKILL); |
270 | return 0; | 270 | return 0; |
271 | } | 271 | } |
272 | if (fault & VM_FAULT_SIGBUS) { | 272 | if (fault & VM_FAULT_SIGBUS) { |
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c index ae2d2c593b..11472f8701 100644 --- a/arch/avr32/mm/fault.c +++ b/arch/avr32/mm/fault.c | |||
@@ -216,7 +216,7 @@ out_of_memory: | |||
216 | } | 216 | } |
217 | printk("VM: Killing process %s\n", tsk->comm); | 217 | printk("VM: Killing process %s\n", tsk->comm); |
218 | if (user_mode(regs)) | 218 | if (user_mode(regs)) |
219 | do_exit(SIGKILL); | 219 | do_group_exit(SIGKILL); |
220 | goto no_context; | 220 | goto no_context; |
221 | 221 | ||
222 | do_sigbus: | 222 | do_sigbus: |
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c index 8672ab7d79..8aab814306 100644 --- a/arch/cris/mm/fault.c +++ b/arch/cris/mm/fault.c | |||
@@ -360,7 +360,7 @@ do_page_fault(unsigned long address, struct pt_regs *regs, | |||
360 | up_read(&mm->mmap_sem); | 360 | up_read(&mm->mmap_sem); |
361 | printk("VM: killing process %s\n", tsk->comm); | 361 | printk("VM: killing process %s\n", tsk->comm); |
362 | if (user_mode(regs)) | 362 | if (user_mode(regs)) |
363 | do_exit(SIGKILL); | 363 | do_group_exit(SIGKILL); |
364 | goto no_context; | 364 | goto no_context; |
365 | 365 | ||
366 | do_sigbus: | 366 | do_sigbus: |
diff --git a/arch/frv/mm/fault.c b/arch/frv/mm/fault.c index 6798fa0257..05093d41d9 100644 --- a/arch/frv/mm/fault.c +++ b/arch/frv/mm/fault.c | |||
@@ -259,7 +259,7 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear | |||
259 | up_read(&mm->mmap_sem); | 259 | up_read(&mm->mmap_sem); |
260 | printk("VM: killing process %s\n", current->comm); | 260 | printk("VM: killing process %s\n", current->comm); |
261 | if (user_mode(__frame)) | 261 | if (user_mode(__frame)) |
262 | do_exit(SIGKILL); | 262 | do_group_exit(SIGKILL); |
263 | goto no_context; | 263 | goto no_context; |
264 | 264 | ||
265 | do_sigbus: | 265 | do_sigbus: |
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c index 9150ffaff9..32f26253c4 100644 --- a/arch/ia64/mm/fault.c +++ b/arch/ia64/mm/fault.c | |||
@@ -281,6 +281,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re | |||
281 | } | 281 | } |
282 | printk(KERN_CRIT "VM: killing process %s\n", current->comm); | 282 | printk(KERN_CRIT "VM: killing process %s\n", current->comm); |
283 | if (user_mode(regs)) | 283 | if (user_mode(regs)) |
284 | do_exit(SIGKILL); | 284 | do_group_exit(SIGKILL); |
285 | goto no_context; | 285 | goto no_context; |
286 | } | 286 | } |
diff --git a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c index 676a1c443d..70a766aad3 100644 --- a/arch/m32r/mm/fault.c +++ b/arch/m32r/mm/fault.c | |||
@@ -278,7 +278,7 @@ out_of_memory: | |||
278 | } | 278 | } |
279 | printk("VM: killing process %s\n", tsk->comm); | 279 | printk("VM: killing process %s\n", tsk->comm); |
280 | if (error_code & ACE_USERMODE) | 280 | if (error_code & ACE_USERMODE) |
281 | do_exit(SIGKILL); | 281 | do_group_exit(SIGKILL); |
282 | goto no_context; | 282 | goto no_context; |
283 | 283 | ||
284 | do_sigbus: | 284 | do_sigbus: |
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c index 578b48f47b..eaa6186811 100644 --- a/arch/m68k/mm/fault.c +++ b/arch/m68k/mm/fault.c | |||
@@ -188,7 +188,7 @@ out_of_memory: | |||
188 | 188 | ||
189 | printk("VM: killing process %s\n", current->comm); | 189 | printk("VM: killing process %s\n", current->comm); |
190 | if (user_mode(regs)) | 190 | if (user_mode(regs)) |
191 | do_exit(SIGKILL); | 191 | do_group_exit(SIGKILL); |
192 | 192 | ||
193 | no_context: | 193 | no_context: |
194 | current->thread.signo = SIGBUS; | 194 | current->thread.signo = SIGBUS; |
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c index 521771b373..5699c7713e 100644 --- a/arch/mips/mm/fault.c +++ b/arch/mips/mm/fault.c | |||
@@ -180,7 +180,7 @@ out_of_memory: | |||
180 | } | 180 | } |
181 | printk("VM: killing process %s\n", tsk->comm); | 181 | printk("VM: killing process %s\n", tsk->comm); |
182 | if (user_mode(regs)) | 182 | if (user_mode(regs)) |
183 | do_exit(SIGKILL); | 183 | do_group_exit(SIGKILL); |
184 | goto no_context; | 184 | goto no_context; |
185 | 185 | ||
186 | do_sigbus: | 186 | do_sigbus: |
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 7899ab8778..1c091b415c 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c | |||
@@ -263,6 +263,6 @@ no_context: | |||
263 | up_read(&mm->mmap_sem); | 263 | up_read(&mm->mmap_sem); |
264 | printk(KERN_CRIT "VM: killing process %s\n", current->comm); | 264 | printk(KERN_CRIT "VM: killing process %s\n", current->comm); |
265 | if (user_mode(regs)) | 265 | if (user_mode(regs)) |
266 | do_exit(SIGKILL); | 266 | do_group_exit(SIGKILL); |
267 | goto no_context; | 267 | goto no_context; |
268 | } | 268 | } |
diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c index b98244e277..94913ddcf7 100644 --- a/arch/ppc/mm/fault.c +++ b/arch/ppc/mm/fault.c | |||
@@ -297,7 +297,7 @@ out_of_memory: | |||
297 | } | 297 | } |
298 | printk("VM: killing process %s\n", current->comm); | 298 | printk("VM: killing process %s\n", current->comm); |
299 | if (user_mode(regs)) | 299 | if (user_mode(regs)) |
300 | do_exit(SIGKILL); | 300 | do_group_exit(SIGKILL); |
301 | return SIGKILL; | 301 | return SIGKILL; |
302 | 302 | ||
303 | do_sigbus: | 303 | do_sigbus: |
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 4c1ac341ec..14c241ccdd 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -218,7 +218,7 @@ static int do_out_of_memory(struct pt_regs *regs, unsigned long error_code, | |||
218 | } | 218 | } |
219 | printk("VM: killing process %s\n", tsk->comm); | 219 | printk("VM: killing process %s\n", tsk->comm); |
220 | if (regs->psw.mask & PSW_MASK_PSTATE) | 220 | if (regs->psw.mask & PSW_MASK_PSTATE) |
221 | do_exit(SIGKILL); | 221 | do_group_exit(SIGKILL); |
222 | do_no_context(regs, error_code, address); | 222 | do_no_context(regs, error_code, address); |
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c index 04a39aa7f1..4729668ce5 100644 --- a/arch/sh/mm/fault.c +++ b/arch/sh/mm/fault.c | |||
@@ -214,7 +214,7 @@ out_of_memory: | |||
214 | } | 214 | } |
215 | printk("VM: killing process %s\n", tsk->comm); | 215 | printk("VM: killing process %s\n", tsk->comm); |
216 | if (user_mode(regs)) | 216 | if (user_mode(regs)) |
217 | do_exit(SIGKILL); | 217 | do_group_exit(SIGKILL); |
218 | goto no_context; | 218 | goto no_context; |
219 | 219 | ||
220 | do_sigbus: | 220 | do_sigbus: |
diff --git a/arch/sh64/mm/fault.c b/arch/sh64/mm/fault.c index 0d069d8214..dd81c669c7 100644 --- a/arch/sh64/mm/fault.c +++ b/arch/sh64/mm/fault.c | |||
@@ -334,7 +334,7 @@ out_of_memory: | |||
334 | } | 334 | } |
335 | printk("VM: killing process %s\n", tsk->comm); | 335 | printk("VM: killing process %s\n", tsk->comm); |
336 | if (user_mode(regs)) | 336 | if (user_mode(regs)) |
337 | do_exit(SIGKILL); | 337 | do_group_exit(SIGKILL); |
338 | goto no_context; | 338 | goto no_context; |
339 | 339 | ||
340 | do_sigbus: | 340 | do_sigbus: |
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c index 50747fe443..e4d9c8e19d 100644 --- a/arch/sparc/mm/fault.c +++ b/arch/sparc/mm/fault.c | |||
@@ -369,7 +369,7 @@ out_of_memory: | |||
369 | up_read(&mm->mmap_sem); | 369 | up_read(&mm->mmap_sem); |
370 | printk("VM: killing process %s\n", tsk->comm); | 370 | printk("VM: killing process %s\n", tsk->comm); |
371 | if (from_user) | 371 | if (from_user) |
372 | do_exit(SIGKILL); | 372 | do_group_exit(SIGKILL); |
373 | goto no_context; | 373 | goto no_context; |
374 | 374 | ||
375 | do_sigbus: | 375 | do_sigbus: |
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 9f7740eee8..e2027f27c0 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c | |||
@@ -463,7 +463,7 @@ out_of_memory: | |||
463 | up_read(&mm->mmap_sem); | 463 | up_read(&mm->mmap_sem); |
464 | printk("VM: killing process %s\n", current->comm); | 464 | printk("VM: killing process %s\n", current->comm); |
465 | if (!(regs->tstate & TSTATE_PRIV)) | 465 | if (!(regs->tstate & TSTATE_PRIV)) |
466 | do_exit(SIGKILL); | 466 | do_group_exit(SIGKILL); |
467 | goto handle_kernel_fault; | 467 | goto handle_kernel_fault; |
468 | 468 | ||
469 | intr_or_no_mm: | 469 | intr_or_no_mm: |
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index be72c2a5b0..c686ae20fd 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c | |||
@@ -593,7 +593,7 @@ out_of_memory: | |||
593 | } | 593 | } |
594 | printk("VM: killing process %s\n", tsk->comm); | 594 | printk("VM: killing process %s\n", tsk->comm); |
595 | if (error_code & 4) | 595 | if (error_code & 4) |
596 | do_exit(SIGKILL); | 596 | do_group_exit(SIGKILL); |
597 | goto no_context; | 597 | goto no_context; |
598 | 598 | ||
599 | do_sigbus: | 599 | do_sigbus: |
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c index 45d28f217c..2f84285994 100644 --- a/arch/xtensa/mm/fault.c +++ b/arch/xtensa/mm/fault.c | |||
@@ -152,7 +152,7 @@ out_of_memory: | |||
152 | } | 152 | } |
153 | printk("VM: killing process %s\n", current->comm); | 153 | printk("VM: killing process %s\n", current->comm); |
154 | if (user_mode(regs)) | 154 | if (user_mode(regs)) |
155 | do_exit(SIGKILL); | 155 | do_group_exit(SIGKILL); |
156 | bad_page_fault(regs, address, SIGKILL); | 156 | bad_page_fault(regs, address, SIGKILL); |
157 | return; | 157 | return; |
158 | 158 | ||