Skip to contentSkip to conversation

PATCH: modular out of memory base patch for 2.4.25

PATCH Tvrtko A. Uršulin 1 participant 2 messages Mar 12, 2004

Subsystems (14)
lore
Share & tools
lore
#0 lore raw

Hello!

This patch enables modular oom killer infrastructure. With this base patch, functionality and behavior is unchanged from vanilla 2.4.25.

Comments?

arch/alpha/config.in +1 -0
diff -Naur linux-2.4.25/arch/alpha/config.in linux-2.4.25-moom/arch/alpha/config.in
@@ -317,6 +317,7 @@
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 tristate 'Kernel support for Linux/Intel ELF binaries' CONFIG_BINFMT_EM86
+source mm/Config.in
 source drivers/parport/Config.in
 endmenu
 
arch/alpha/defconfig +2 -0
diff -Naur linux-2.4.25/arch/alpha/defconfig linux-2.4.25-moom/arch/alpha/defconfig
@@ -74,6 +74,8 @@
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_BINFMT_EM86 is not set
+# CONFIG_OOM_KILL is not set
+
 
 #
 # Parallel port support
arch/arm/config.in +1 -0
diff -Naur linux-2.4.25/arch/arm/config.in linux-2.4.25-moom/arch/arm/config.in
@@ -500,6 +500,7 @@
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+source mm/Config.in
 dep_bool 'Power Management support (experimental)' CONFIG_PM $CONFIG_EXPERIMENTAL
 dep_tristate 'RISC OS personality' CONFIG_ARTHUR $CONFIG_CPU_32
 string 'Default kernel command string' CONFIG_CMDLINE ""
arch/arm/defconfig +1 -0
diff -Naur linux-2.4.25/arch/arm/defconfig linux-2.4.25-moom/arch/arm/defconfig
@@ -93,6 +93,7 @@
 CONFIG_LEDS_TIMER=y
 CONFIG_LEDS_CPU=y
 CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_OOM_KILL is not set
 
 #
 # Parallel port support
arch/cris/config.in +1 -0
diff -Naur linux-2.4.25/arch/cris/config.in linux-2.4.25-moom/arch/cris/config.in
@@ -31,6 +31,7 @@
 bool 'Sysctl support' CONFIG_SYSCTL
 
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+source mm/Config.in
 
 string 'Kernel command line' CONFIG_ETRAX_CMDLINE "root=/dev/mtdblock3"
 
arch/cris/defconfig +1 -0
diff -Naur linux-2.4.25/arch/cris/defconfig linux-2.4.25-moom/arch/cris/defconfig
@@ -20,6 +20,7 @@
 CONFIG_BINFMT_ELF=y
 # CONFIG_ETRAX_KGDB is not set
 # CONFIG_ETRAX_WATCHDOG is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Hardware setup
arch/i386/config.in +1 -1
diff -Naur linux-2.4.25/arch/i386/config.in linux-2.4.25-moom/arch/i386/config.in
@@ -328,7 +328,7 @@
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
+source mm/Config.in
 
 bool 'Power Management support' CONFIG_PM
 
arch/i386/defconfig +1 -0
diff -Naur linux-2.4.25/arch/i386/defconfig linux-2.4.25-moom/arch/i386/defconfig
@@ -83,6 +83,7 @@
 # CONFIG_EISA is not set
 # CONFIG_MCA is not set
 CONFIG_HOTPLUG=y
+# CONFIG_OOM_KILL is not set
 
 #
 # PCMCIA/CardBus support
arch/ia64/config.in +1 -0
diff -Naur linux-2.4.25/arch/ia64/config.in linux-2.4.25-moom/arch/ia64/config.in
@@ -125,6 +125,7 @@
 bool 'Sysctl support' CONFIG_SYSCTL
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+source mm/Config.in
 
 if [ "$CONFIG_IA64_HP_SIM" = "n" ]; then
   define_bool CONFIG_ACPI y
arch/ia64/defconfig +1 -0
diff -Naur linux-2.4.25/arch/ia64/defconfig linux-2.4.25-moom/arch/ia64/defconfig
@@ -65,6 +65,7 @@
 CONFIG_ACPI_EFI=y
 CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_KERNEL_CONFIG=y
+# CONFIG_OOM_KILL is not set
 
 #
 # ACPI Support
arch/m68k/config.in +1 -0
diff -Naur linux-2.4.25/arch/m68k/config.in linux-2.4.25-moom/arch/m68k/config.in
@@ -100,6 +100,7 @@
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+source mm/Config.in
 
 if [ "$CONFIG_AMIGA" = "y" ]; then
   bool 'Amiga Zorro (AutoConfig) bus support' CONFIG_ZORRO
arch/m68k/defconfig +1 -0
diff -Naur linux-2.4.25/arch/m68k/defconfig linux-2.4.25-moom/arch/m68k/defconfig
@@ -53,6 +53,7 @@
 CONFIG_PROC_HARDWARE=y
 # CONFIG_PARPORT is not set
 # CONFIG_PRINTER is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Loadable module support
arch/mips/config-shared.in +1 -1
diff -Naur linux-2.4.25/arch/mips/config-shared.in linux-2.4.25-moom/arch/mips/config-shared.in
@@ -955,7 +955,7 @@
 fi
 
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
+source mm/Config.in
 
 if [ "$CONFIG_SOC_AU1X00" = "y" ]; then
    bool 'Power Management support' CONFIG_PM
arch/mips/defconfig +1 -1
diff -Naur linux-2.4.25/arch/mips/defconfig linux-2.4.25-moom/arch/mips/defconfig
@@ -144,7 +144,7 @@
 # CONFIG_MIPS32_N32 is not set
 # CONFIG_BINFMT_ELF32 is not set
 # CONFIG_BINFMT_MISC is not set
-# CONFIG_OOM_KILLER is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Memory Technology Devices (MTD)
arch/mips64/defconfig +1 -1
diff -Naur linux-2.4.25/arch/mips64/defconfig linux-2.4.25-moom/arch/mips64/defconfig
@@ -142,7 +142,7 @@
 # CONFIG_MIPS32_N32 is not set
 CONFIG_BINFMT_ELF32=y
 # CONFIG_BINFMT_MISC is not set
-# CONFIG_OOM_KILLER is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Memory Technology Devices (MTD)
arch/parisc/config.in +1 -0
diff -Naur linux-2.4.25/arch/parisc/config.in linux-2.4.25-moom/arch/parisc/config.in
@@ -91,6 +91,7 @@
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for SOM binaries' CONFIG_BINFMT_SOM
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+source mm/Config.in
 
 # anyone want to get ACPI working on PA/RISC?
 define_bool CONFIG_PM n
arch/parisc/defconfig +1 -0
diff -Naur linux-2.4.25/arch/parisc/defconfig linux-2.4.25-moom/arch/parisc/defconfig
@@ -45,6 +45,7 @@
 CONFIG_IOMMU_SBA=y
 CONFIG_SUPERIO=y
 CONFIG_PCI_NAMES=y
+# CONFIG_OOM_KILL is not set
 
 #
 # General setup
arch/ppc/config.in +1 -1
diff -Naur linux-2.4.25/arch/ppc/config.in linux-2.4.25-moom/arch/ppc/config.in
@@ -352,7 +352,7 @@
 define_bool CONFIG_BINFMT_ELF y
 define_bool CONFIG_KERNEL_ELF y
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
+source mm/Config.in
 
 source drivers/pci/Config.in
 
arch/ppc/defconfig +1 -1
diff -Naur linux-2.4.25/arch/ppc/defconfig linux-2.4.25-moom/arch/ppc/defconfig
@@ -60,9 +60,9 @@
 CONFIG_BINFMT_ELF=y
 CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_MISC=m
-# CONFIG_OOM_KILLER is not set
 CONFIG_PCI_NAMES=y
 CONFIG_HOTPLUG=y
+# CONFIG_OOM_KILL is not set
 
 #
 # PCMCIA/CardBus support
arch/ppc64/config.in +2 -1
diff -Naur linux-2.4.25/arch/ppc64/config.in linux-2.4.25-moom/arch/ppc64/config.in
@@ -1,4 +1,4 @@
-# 
+#
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/config-language.txt.
 #
@@ -86,6 +86,7 @@
 tristate 'Kernel support for 32 bit ELF binaries' CONFIG_BINFMT_ELF32
 
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+source mm/Config.in
 
 source drivers/pci/Config.in
 
arch/ppc64/defconfig +1 -0
diff -Naur linux-2.4.25/arch/ppc64/defconfig linux-2.4.25-moom/arch/ppc64/defconfig
@@ -60,6 +60,7 @@
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PCI_NAMES=y
 # CONFIG_HOTPLUG is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Parallel port support
arch/s390/config.in +1 -0
diff -Naur linux-2.4.25/arch/s390/config.in linux-2.4.25-moom/arch/s390/config.in
@@ -59,6 +59,7 @@
 define_bool CONFIG_KCORE_ELF y
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+source mm/Config.in
 bool 'Show crashed user process info' CONFIG_PROCESS_DEBUG
 bool 'Pseudo page fault support' CONFIG_PFAULT
 bool 'VM shared kernel support' CONFIG_SHARED_KERNEL
arch/s390/defconfig +1 -0
diff -Naur linux-2.4.25/arch/s390/defconfig linux-2.4.25-moom/arch/s390/defconfig
@@ -50,6 +50,7 @@
 # CONFIG_PROCESS_DEBUG is not set
 CONFIG_PFAULT=y
 # CONFIG_SHARED_KERNEL is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Block device drivers
arch/s390x/config.in +1 -0
diff -Naur linux-2.4.25/arch/s390x/config.in linux-2.4.25-moom/arch/s390x/config.in
@@ -62,6 +62,7 @@
 define_bool CONFIG_KCORE_ELF y
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+source mm/Config.in
 bool 'Show crashed user process info' CONFIG_PROCESS_DEBUG
 bool 'Pseudo page fault support' CONFIG_PFAULT
 bool 'VM shared kernel support' CONFIG_SHARED_KERNEL
arch/s390x/defconfig +1 -0
diff -Naur linux-2.4.25/arch/s390x/defconfig linux-2.4.25-moom/arch/s390x/defconfig
@@ -51,6 +51,7 @@
 # CONFIG_PROCESS_DEBUG is not set
 CONFIG_PFAULT=y
 # CONFIG_SHARED_KERNEL is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Block device drivers
arch/sh/config.in +2 -3
diff -Naur linux-2.4.25/arch/sh/config.in linux-2.4.25-moom/arch/sh/config.in
@@ -284,8 +284,7 @@
 fi
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-
-bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
+source mm/Config.in
 
 source drivers/parport/Config.in
 
@@ -492,4 +491,4 @@
 endmenu
 
 source crypto/Config.in
-source lib/Config.in
+source lib/Config.in
\ No newline at end of file
arch/sh/defconfig +1 -0
diff -Naur linux-2.4.25/arch/sh/defconfig linux-2.4.25-moom/arch/sh/defconfig
@@ -49,6 +49,7 @@
 # CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Parallel port support
arch/sh64/config.in +1 -2
diff -Naur linux-2.4.25/arch/sh64/config.in linux-2.4.25-moom/arch/sh64/config.in
@@ -154,8 +154,7 @@
 fi
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
-
-bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
+source mm/Config.in
 
 # source drivers/parport/Config.in
 
arch/sh64/defconfig +1 -0
diff -Naur linux-2.4.25/arch/sh64/defconfig linux-2.4.25-moom/arch/sh64/defconfig
@@ -84,6 +84,7 @@
 # CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Block devices
arch/sparc/config.in +1 -1
diff -Naur linux-2.4.25/arch/sparc/config.in linux-2.4.25-moom/arch/sparc/config.in
@@ -76,7 +76,7 @@
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 bool 'SunOS binary emulation' CONFIG_SUNOS_EMUL
-bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
+source mm/Config.in
 source drivers/parport/Config.in
 dep_tristate '  Parallel printer support' CONFIG_PRINTER $CONFIG_PARPORT
 endmenu
arch/sparc/defconfig +1 -1
diff -Naur linux-2.4.25/arch/sparc/defconfig linux-2.4.25-moom/arch/sparc/defconfig
@@ -53,7 +53,7 @@
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=m
 CONFIG_SUNOS_EMUL=y
-# CONFIG_OOM_KILLER is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Parallel port support
arch/sparc64/config.in +1 -1
diff -Naur linux-2.4.25/arch/sparc64/config.in linux-2.4.25-moom/arch/sparc64/config.in
@@ -82,7 +82,7 @@
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
    tristate 'Solaris binary emulation (EXPERIMENTAL)' CONFIG_SOLARIS_EMUL
 fi
-bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
+source mm/Config.in
 source drivers/parport/Config.in
 dep_tristate '  Parallel printer support' CONFIG_PRINTER $CONFIG_PARPORT
 if [ "$CONFIG_PCI" = "y" ]; then
arch/sparc64/defconfig +1 -1
diff -Naur linux-2.4.25/arch/sparc64/defconfig linux-2.4.25-moom/arch/sparc64/defconfig
@@ -59,7 +59,7 @@
 CONFIG_BINFMT_MISC=m
 # CONFIG_SUNOS_EMUL is not set
 CONFIG_SOLARIS_EMUL=m
-# CONFIG_OOM_KILLER is not set
+# CONFIG_OOM_KILL is not set
 
 #
 # Parallel port support
arch/x86_64/config.in +1 -0
diff -Naur linux-2.4.25/arch/x86_64/config.in linux-2.4.25-moom/arch/x86_64/config.in
@@ -110,6 +110,7 @@
 #tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+source mm/Config.in
 
 bool 'Power Management support' CONFIG_PM
 
arch/x86_64/defconfig +1 -0
diff -Naur linux-2.4.25/arch/x86_64/defconfig linux-2.4.25-moom/arch/x86_64/defconfig
@@ -68,6 +68,7 @@
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PM=y
 CONFIG_IA32_EMULATION=y
+# CONFIG_OOM_KILL is not set
 
 #
 # ACPI Support
Documentation/Configure.help +15 -14
diff -Naur linux-2.4.25/Documentation/Configure.help linux-2.4.25-moom/Documentation/Configure.help
@@ -412,20 +412,6 @@
   Otherwise low memory pages are used as bounce buffers causing a
   degrade in performance.
 
-OOM killer support
-CONFIG_OOM_KILLER
-   This option selects the kernel behaviour during total out of memory
-   condition. 
-
-   The default behaviour is to, as soon as no freeable memory and no swap
-   space are available, kill the task which tries to allocate memory. 
-   The default behaviour is very reliable.
-
-   If you select this option, as soon as no freeable memory is available, 
-   the kernel will try to select the "best" task to be killed.
-
-   If unsure, say N.
-
 Normal floppy disk support
 CONFIG_BLK_DEV_FD
   If you want to use the floppy disk drive(s) of your PC under Linux,
@@ -440,6 +426,21 @@
   The module will be called floppy.o. If you want to compile it as a
   module, say M here and read <file:Documentation/modules.txt>.
 
+Classic out of memory killer
+CONFIG_OOM_KILL
+  This option enables the traditional oom_kill.c mechanism for
+  killing processes in an attempt to recover from an out-of-memory
+  condition.
+
+  The default behaviour is to, as soon as no freeable memory and no swap
+  space are available, kill the task which tries to allocate memory. 
+  The default behaviour is very reliable.
+
+  If you select this option, as soon as no freeable memory is available, 
+  the kernel will try to select the "best" task to be killed.
+  
+  If unsure, say N.
+
 iSeries Virtual I/O Disk Support
 CONFIG_VIODASD
   If you are running on an iSeries system and you want to use
include/linux/mm.h +2 -0
diff -Naur linux-2.4.25/include/linux/mm.h linux-2.4.25-moom/include/linux/mm.h
@@ -338,6 +338,8 @@
 struct zone_struct;
 extern struct zone_struct *zone_table[];
 
+extern int get_nr_swap_pages (void);
+
 static inline zone_t *page_zone(struct page *page)
 {
 	return zone_table[page->flags >> ZONE_SHIFT];
include/linux/notifier.h +3 -0
diff -Naur linux-2.4.25/include/linux/notifier.h linux-2.4.25-moom/include/linux/notifier.h
@@ -60,5 +60,8 @@
 
 #define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
 
+#define OUT_OF_MEMORY  0x00001 /* Notify of critical memory shortage */
+
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_NOTIFIER_H */
include/linux/oom_notifier.h +40 -0
diff -Naur linux-2.4.25/include/linux/oom_notifier.h linux-2.4.25-moom/include/linux/oom_notifier.h
@@ -0,0 +1,40 @@
+#ifndef _LINUX_OOM_NOTIFIER_H
+#define _LINUX_OOM_NOTIFIER_H
+
+
+#ifdef debug
+#undef dbg
+#endif
+#define dbg(format, arg...)					\
+do {							\
+		printk (KERN_DEBUG "Out of memory: " format "\n",	## arg);                        \
+} while(0)
+
+#ifdef warn
+#undef warn
+#endif
+#define warn(format, arg...)					  \
+do {							  \
+		printk (KERN_WARNING "Out of memory: " format "\n", ## arg);                          \
+} while(0)
+
+#ifdef info
+#undef info
+#endif
+#define info(format, arg...)					  \
+do {							  \
+		printk (KERN_INFO "Out of Memory: " format "\n", ## arg);                          \
+} while(0)
+
+#ifdef error
+#undef error
+#endif
+#define error(format, arg...)					        \
+do {							        \
+		printk (KERN_ERR "Out of Memory: " format "\n",	## arg);                                \
+} while(0)
+
+int register_oom_notifier(struct notifier_block * nb);
+int unregister_oom_notifier(struct notifier_block * nb);
+
+#endif /* _LINUX_OOM_NOTIFIER_H */
include/linux/sysctl.h +2 -1
diff -Naur linux-2.4.25/include/linux/sysctl.h linux-2.4.25-moom/include/linux/sysctl.h
@@ -156,6 +156,7 @@
 	VM_MAPPED_RATIO=20,     /* amount of unfreeable pages that triggers swapout */
 	VM_LAPTOP_MODE=21,	/* kernel in laptop flush mode */
 	VM_BLOCK_DUMP=22,	/* dump fs activity to log */
+	VM_OOM=23,   /* Out of memory */
 };
 
 
@@ -810,7 +811,7 @@
 	struct list_head ctl_entry;
 };
 
-struct ctl_table_header * register_sysctl_table(ctl_table * table, 
+struct ctl_table_header * register_sysctl_table(ctl_table * table,
 						int insert_at_head);
 void unregister_sysctl_table(struct ctl_table_header * table);
 
mm/Config.in +6 -0
diff -Naur linux-2.4.25/mm/Config.in linux-2.4.25-moom/mm/Config.in
@@ -0,0 +1,6 @@
+mainmenu_option next_comment
+comment 'Out of memory killer'
+
+tristate 'Classic' CONFIG_OOM_KILL
+
+endmenu
mm/Makefile +5 -3
diff -Naur linux-2.4.25/mm/Makefile linux-2.4.25-moom/mm/Makefile
@@ -9,13 +9,15 @@
 
 O_TARGET := mm.o
 
-export-objs := shmem.o filemap.o memory.o page_alloc.o
+export-objs := shmem.o filemap.o memory.o page_alloc.o oom_notifier.o
 
 obj-y	 := memory.o mmap.o filemap.o mprotect.o mlock.o mremap.o \
 	    vmalloc.o slab.o bootmem.o swap.o vmscan.o page_io.o \
-	    page_alloc.o swap_state.o swapfile.o numa.o oom_kill.o \
-	    shmem.o
+	    page_alloc.o swap_state.o swapfile.o numa.o \
+	    shmem.o oom_notifier.o
 
 obj-$(CONFIG_HIGHMEM) += highmem.o
 
+obj-$(CONFIG_OOM_KILL)  += oom_kill.o
+
 include $(TOPDIR)/Rules.make
mm/oom_kill.c +49 -7

99 lines not on this page · raw message

mm/oom_notifier.c +44 -0

44 lines not on this page · raw message

mm/page_alloc.c +9 -0
diff -Naur linux-2.4.25/mm/page_alloc.c linux-2.4.25-moom/mm/page_alloc.c
@@ -495,6 +495,15 @@
 }
 
 /*
+ * Total amount of swap pages
+ */
+int get_nr_swap_pages (void)
+{
+	return nr_swap_pages;	
+}
+EXPORT_SYMBOL(get_nr_swap_pages);
+
+/*
  * Amount of free RAM allocatable as buffer memory:
  */
 unsigned int nr_free_buffer_pages (void)
#1 lore raw

Re: PATCH: modular out of memory additional modules patch for 2.4.25

These are two additional modules for OOM, oom-panic and oom-parent-kill. Details can be found in Configure.help.

arch/alpha/defconfig +2 -0
diff -Naur linux-2.4.25/arch/alpha/defconfig linux-2.4.25-moom/arch/alpha/defconfig
@@ -75,6 +75,8 @@
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_BINFMT_EM86 is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 
 #
arch/arm/defconfig +2 -0
diff -Naur linux-2.4.25/arch/arm/defconfig linux-2.4.25-moom/arch/arm/defconfig
@@ -94,6 +94,8 @@
 CONFIG_LEDS_CPU=y
 CONFIG_ALIGNMENT_TRAP=y
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Parallel port support
arch/cris/defconfig +2 -0
diff -Naur linux-2.4.25/arch/cris/defconfig linux-2.4.25-moom/arch/cris/defconfig
@@ -21,6 +21,8 @@
 # CONFIG_ETRAX_KGDB is not set
 # CONFIG_ETRAX_WATCHDOG is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Hardware setup
arch/i386/defconfig +2 -0
diff -Naur linux-2.4.25/arch/i386/defconfig linux-2.4.25-moom/arch/i386/defconfig
@@ -84,6 +84,8 @@
 # CONFIG_MCA is not set
 CONFIG_HOTPLUG=y
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # PCMCIA/CardBus support
arch/ia64/defconfig +2 -0
diff -Naur linux-2.4.25/arch/ia64/defconfig linux-2.4.25-moom/arch/ia64/defconfig
@@ -66,6 +66,8 @@
 CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_KERNEL_CONFIG=y
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # ACPI Support
arch/m68k/defconfig +2 -0
diff -Naur linux-2.4.25/arch/m68k/defconfig linux-2.4.25-moom/arch/m68k/defconfig
@@ -54,6 +54,8 @@
 # CONFIG_PARPORT is not set
 # CONFIG_PRINTER is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Loadable module support
arch/mips/defconfig +2 -0
diff -Naur linux-2.4.25/arch/mips/defconfig linux-2.4.25-moom/arch/mips/defconfig
@@ -145,6 +145,8 @@
 # CONFIG_BINFMT_ELF32 is not set
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Memory Technology Devices (MTD)
arch/mips64/defconfig +2 -0
diff -Naur linux-2.4.25/arch/mips64/defconfig linux-2.4.25-moom/arch/mips64/defconfig
@@ -143,6 +143,8 @@
 CONFIG_BINFMT_ELF32=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Memory Technology Devices (MTD)
arch/parisc/defconfig +2 -0
diff -Naur linux-2.4.25/arch/parisc/defconfig linux-2.4.25-moom/arch/parisc/defconfig
@@ -46,6 +46,8 @@
 CONFIG_SUPERIO=y
 CONFIG_PCI_NAMES=y
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # General setup
arch/ppc/defconfig +2 -0
diff -Naur linux-2.4.25/arch/ppc/defconfig linux-2.4.25-moom/arch/ppc/defconfig
@@ -63,6 +63,8 @@
 CONFIG_PCI_NAMES=y
 CONFIG_HOTPLUG=y
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # PCMCIA/CardBus support
arch/ppc64/defconfig +2 -0
diff -Naur linux-2.4.25/arch/ppc64/defconfig linux-2.4.25-moom/arch/ppc64/defconfig
@@ -61,6 +61,8 @@
 CONFIG_PCI_NAMES=y
 # CONFIG_HOTPLUG is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Parallel port support
arch/s390/defconfig +2 -0
diff -Naur linux-2.4.25/arch/s390/defconfig linux-2.4.25-moom/arch/s390/defconfig
@@ -51,6 +51,8 @@
 CONFIG_PFAULT=y
 # CONFIG_SHARED_KERNEL is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Block device drivers
arch/s390x/defconfig +2 -0
diff -Naur linux-2.4.25/arch/s390x/defconfig linux-2.4.25-moom/arch/s390x/defconfig
@@ -52,6 +52,8 @@
 CONFIG_PFAULT=y
 # CONFIG_SHARED_KERNEL is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Block device drivers
arch/sh/defconfig +2 -0
diff -Naur linux-2.4.25/arch/sh/defconfig linux-2.4.25-moom/arch/sh/defconfig
@@ -50,6 +50,8 @@
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Parallel port support
arch/sh64/defconfig +2 -0
diff -Naur linux-2.4.25/arch/sh64/defconfig linux-2.4.25-moom/arch/sh64/defconfig
@@ -85,6 +85,8 @@
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Block devices
arch/sparc/defconfig +2 -0
diff -Naur linux-2.4.25/arch/sparc/defconfig linux-2.4.25-moom/arch/sparc/defconfig
@@ -54,6 +54,8 @@
 CONFIG_BINFMT_MISC=m
 CONFIG_SUNOS_EMUL=y
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Parallel port support
arch/sparc64/defconfig +2 -0
diff -Naur linux-2.4.25/arch/sparc64/defconfig linux-2.4.25-moom/arch/sparc64/defconfig
@@ -60,6 +60,8 @@
 # CONFIG_SUNOS_EMUL is not set
 CONFIG_SOLARIS_EMUL=m
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # Parallel port support
arch/x86_64/defconfig +2 -0
diff -Naur linux-2.4.25/arch/x86_64/defconfig linux-2.4.25-moom/arch/x86_64/defconfig
@@ -69,6 +69,8 @@
 CONFIG_PM=y
 CONFIG_IA32_EMULATION=y
 # CONFIG_OOM_KILL is not set
+# CONFIG_OOM_KPPID is not set
+# CONFIG_OOM_PANIC is not set
 
 #
 # ACPI Support
Documentation/Configure.help +23 -0
diff -Naur linux-2.4.25/Documentation/Configure.help linux-2.4.25-moom/Documentation/Configure.help
@@ -441,6 +441,29 @@
   
   If unsure, say N.
 
+Panic on out of memory conditions
+CONFIG_OOM_PANIC
+  This option enables panic() to be called when a system is out of
+  memory.  This feature along with /proc/sys/kernel/panic allows a
+  different behavior on out-of-memory conditions when the standard
+  behavior (killing processes in an attempt to recover) does not
+  make sense.
+  
+  If unsure, say N.
+
+Kill parents that keep producing bad children  
+CONFIG_OOM_KPPID
+  This option enables an out-of-memory handler that not only attempts
+  to kill bad processes to free up memory, but also kills parents
+  that repeatedly produce bad children.
+
+  Two tunables, oom_parent_max and oom_parent_expire, will be added
+  and  to /proc/sys/vm/ to control how many children a parent is
+  allowed to have terminated, and how long between terminated children
+  before a parent is forgiven.
+  
+  If unsure, say N.
+
 iSeries Virtual I/O Disk Support
 CONFIG_VIODASD
   If you are running on an iSeries system and you want to use
mm/Config.in +28 -0
diff -Naur linux-2.4.25/mm/Config.in linux-2.4.25-moom/mm/Config.in
@@ -2,5 +2,33 @@
 comment 'Out of memory killer'
 
 tristate 'Classic' CONFIG_OOM_KILL
+if [ "$CONFIG_OOM_KILL" = "y" ]; then
+	if [ "$CONFIG_OOM_PANIC" = "y" ]; then
+		define_tristate CONFIG_OOM_PANIC m
+	fi
+	if [ "$CONFIG_OOM_KPPID" = "y" ]; then
+		define_tristate CONFIG_OOM_KPPID m
+	fi
+fi
+
+tristate 'Kill parents' CONFIG_OOM_KPPID
+if [ "$CONFIG_OOM_KPPID" = "y" ]; then
+	if [ "$CONFIG_OOM_PANIC" = "y" ]; then
+		define_tristate CONFIG_OOM_PANIC m
+	fi
+	if [ "$CONFIG_OOM_KILL" = "y" ]; then
+		define_tristate CONFIG_OOM_KILL m
+	fi
+fi
+
+tristate 'Panic' CONFIG_OOM_PANIC
+if [ "$CONFIG_OOM_PANIC" = "y" ]; then
+	if [ "$CONFIG_OOM_KILL" = "y" ]; then
+		define_tristate CONFIG_OOM_KILL m
+	fi
+	if [ "$CONFIG_OOM_KPPID" = "y" ]; then
+		define_tristate CONFIG_OOM_KPPID m
+	fi
+fi
 
 endmenu
mm/Makefile +2 -0
diff -Naur linux-2.4.25/mm/Makefile linux-2.4.25-moom/mm/Makefile
@@ -19,5 +19,7 @@
 obj-$(CONFIG_HIGHMEM) += highmem.o
 
 obj-$(CONFIG_OOM_KILL)  += oom_kill.o
+obj-$(CONFIG_OOM_KPPID) += oom_kill_parent.o
+obj-$(CONFIG_OOM_PANIC) += oom_panic.o
 
 include $(TOPDIR)/Rules.make
mm/oom_kill.c +1 -1
diff -Naur linux-2.4.25/mm/oom_kill.c linux-2.4.25-moom/mm/oom_kill.c
@@ -15,7 +15,7 @@
  *  kernel subsystems and hints as to where to find out what things do.
  *
  * Modularized by using notifies by --rustyl <[email protected]>
- * Final modularization (C) 2003,2004  Tvrtko A. Ursulin ([email protected])
+ * Final modularization (C) 2003  Tvrtko A. Ursulin ([email protected])
  */
 
 #include <linux/kernel.h>
mm/oom_kill_parent.c +458 -0

458 lines not on this page · raw message

mm/oom_panic.c +50 -0

50 lines not on this page · raw message