]> Pileus Git - ~andy/linux/commitdiff
During VM oom condition, kill all threads in process group
authorWill Schmidt <will_schmidt@vnet.ibm.com>
Tue, 16 Oct 2007 08:24:18 +0000 (01:24 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 16 Oct 2007 16:42:52 +0000 (09:42 -0700)
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>
18 files changed:
arch/alpha/mm/fault.c
arch/arm/mm/fault.c
arch/avr32/mm/fault.c
arch/cris/mm/fault.c
arch/frv/mm/fault.c
arch/ia64/mm/fault.c
arch/m32r/mm/fault.c
arch/m68k/mm/fault.c
arch/mips/mm/fault.c
arch/parisc/mm/fault.c
arch/ppc/mm/fault.c
arch/s390/mm/fault.c
arch/sh/mm/fault.c
arch/sh64/mm/fault.c
arch/sparc/mm/fault.c
arch/sparc64/mm/fault.c
arch/x86/mm/fault_32.c
arch/xtensa/mm/fault.c

index a0e18da594d94216e716d69f66b2cec0074aa43d..25154df3055abf7a501db5b5b00255d0bcbb410e 100644 (file)
@@ -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
index 846cce48e2b7fa8e2a012bfab6e76e1431390155..59ed1d05b71bf6d858e515d928da4ad102276d91 100644 (file)
@@ -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) {
index ae2d2c593b2b027efa74f6a69ab31efabf8ec5b6..11472f8701bdf4a88202d81e723efef38208e743 100644 (file)
@@ -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:
index 8672ab7d7978f4e0303c8bd466062487d246f478..8aab814306955a68a150a2453cfcb72f62c2441f 100644 (file)
@@ -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:
index 6798fa0257b1521cab1c033c806d10236fc8c389..05093d41d98ea77c9213f50d8920cfc69d4c3874 100644 (file)
@@ -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:
index 9150ffaff9e891da5ed52fbc05ed040d026afabc..32f26253c4e8cea6b938e8babdffb96e826e6ac8 100644 (file)
@@ -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;
 }
index 676a1c443d28c7dfbc22243f6aeb395fb3c84494..70a766aad3e0bdbcdc22b6dfd11033d3183846aa 100644 (file)
@@ -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:
index 578b48f47b9e3db8a8f30397351fe841ca7ea85a..eaa618681159524ec1cf287b2ff1c91bf72d2da7 100644 (file)
@@ -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;
index 521771b373dedb2bb9dbab8e2a65c3c27be69044..5699c7713e2f01c5b42f7803df82c61c4b48ec8c 100644 (file)
@@ -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:
index 7899ab87785aab13576aedac86431d931699aae8..1c091b415cd9b8375506c470527ae929b9900b9c 100644 (file)
@@ -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;
 }
index b98244e277fbc97857af375d6fb7339f39c5deb7..94913ddcf76e8524392dec4f5d9b53bccbc2011f 100644 (file)
@@ -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:
index 4c1ac341ec80633c95194f3c83ab7f358b36189a..14c241ccdd4d9aa47c8697cdb4f9492821c1e224 100644 (file)
@@ -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;
 }
index 04a39aa7f1f97029a8c182b93077c9f2a7a67e57..4729668ce5bf3b4ca261d689906ed14db30e01e5 100644 (file)
@@ -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:
index 0d069d82141f22e3283a99c174bb3217a016a3f8..dd81c669c79b5b63df7c52447f320c96d8a15dd4 100644 (file)
@@ -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:
index 50747fe443568219995122592797e6e9f0be00c1..e4d9c8e19df5d1e70c3de848898cba9fe977eda4 100644 (file)
@@ -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:
index 9f7740eee8d2957eeaf6170648f390a08e8a4268..e2027f27c0fe73f2f43546aa838577e86fc6e3ba 100644 (file)
@@ -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:
index be72c2a5b03b4a1e4fea65b3431faf21d1491d3a..c686ae20fd6bbd802b18048ba9e7914c50053ac4 100644 (file)
@@ -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:
index 45d28f217c030933f9d2076d3bcf394e00dca484..2f842859948f5993780b83fae5d3e66390bf1d6d 100644 (file)
@@ -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;