1 diff -NurpP --exclude '*.orig' --exclude '*.rej' linux-2.6.27.10-vs2.3.x-P/init/Kconfig linux-2.6.27.10-vs2.3.x-P540/init/Kconfig
2 --- linux-2.6.27.10-vs2.3.x-P/init/Kconfig 2008-10-13 14:52:09.000000000 +0200
3 +++ linux-2.6.27.10-vs2.3.x-P540/init/Kconfig 2009-01-12 01:18:23.000000000 +0100
4 @@ -306,6 +306,23 @@ config CGROUP_DEVICE
5 Provides a cgroup implementing whitelists for devices which
6 a process in the cgroup can mknod or open.
12 + This option enables panic() to be called when a system is out of
13 + memory. This feature along with /proc/sys/kernel/panic allows a
14 + different behavior on out-of-memory conditions when the standard
15 + behavior (killing processes in an attempt to recover) does not
22 + depends on !OOM_PANIC
27 depends on SMP && CGROUPS
28 diff -NurpP --exclude '*.orig' --exclude '*.rej' linux-2.6.27.10-vs2.3.x-P/mm/oom_kill.c linux-2.6.27.10-vs2.3.x-P540/mm/oom_kill.c
29 --- linux-2.6.27.10-vs2.3.x-P/mm/oom_kill.c 2008-10-13 14:54:20.000000000 +0200
30 +++ linux-2.6.27.10-vs2.3.x-P540/mm/oom_kill.c 2009-01-12 01:18:23.000000000 +0100
31 @@ -176,6 +176,11 @@ unsigned long badness(struct task_struct
35 +#if defined(CONFIG_OOM_PANIC) && defined(CONFIG_OOM_KILLER)
36 +#warning Only define OOM_PANIC or OOM_KILLER; not both
39 +#ifdef CONFIG_OOM_KILLER
41 * Determine the type of allocation constraint.
43 @@ -597,3 +602,37 @@ out:
44 if (!test_thread_flag(TIF_MEMDIE))
45 schedule_timeout_uninterruptible(1);
47 +#endif /* CONFIG_OOM_KILLER */
49 +#ifdef CONFIG_OOM_PANIC
51 + * out_of_memory - panic if the system out of memory?
53 +void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
56 + * oom_lock protects out_of_memory()'s static variables.
57 + * It's a global lock; this is not performance-critical.
59 + static spinlock_t oom_lock = SPIN_LOCK_UNLOCKED;
60 + static unsigned long count;
62 + spin_lock(&oom_lock);
65 + * If we have gotten only a few failures,
66 + * we're not really oom.
68 + if (++count >= 10) {
70 + * Ok, really out of memory. Panic.
73 + printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
76 + panic("Out Of Memory");
78 + spin_unlock(&oom_lock);
80 +#endif /* CONFIG_OOM_PANIC */
81 diff -NurpP --exclude '*.orig' --exclude '*.rej' linux-2.6.27.10-vs2.3.x-P/mm/oom_panic.c linux-2.6.27.10-vs2.3.x-P540/mm/oom_panic.c
82 --- linux-2.6.27.10-vs2.3.x-P/mm/oom_panic.c 1970-01-01 01:00:00.000000000 +0100
83 +++ linux-2.6.27.10-vs2.3.x-P540/mm/oom_panic.c 2009-01-12 01:18:23.000000000 +0100
86 + * Just panic() instead of the default behavior of selecting processes
90 + * Modular OOM handlers for 2.6.4 (C) 2003,2004 Tvrtko A. Ursulin
92 + * linux/mm/oom_kill.c (C) 1998,2000 Rik van Riel.
94 + * Mark Huang <mlhuang@cs.princeton.edu>
96 + * $Id: oom_panic.c,v 1.1 2004/10/01 17:54:48 mlhuang Exp $
99 +#include <linux/mm.h>
100 +#include <linux/sched.h>
101 +#include <linux/swap.h>
104 + * out_of_memory - is the system out of memory?
106 +void out_of_memory(int gfp_mask)
109 + * oom_lock protects out_of_memory()'s static variables.
110 + * It's a global lock; this is not performance-critical.
112 + static spinlock_t oom_lock = SPIN_LOCK_UNLOCKED;
113 + static unsigned long count;
115 + spin_lock(&oom_lock);
118 + * If we have gotten only a few failures,
119 + * we're not really oom.
125 + * Ok, really out of memory. Panic.
128 + printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
131 + panic("Out Of Memory");
134 + spin_unlock(&oom_lock);
138 diff -NurpP --exclude '*.orig' --exclude '*.rej' linux-2.6.27.10-vs2.3.x-PS-02.0/mm/oom_kill.c linux-2.6.27.10-vs2.3.x-PS-02.1/mm/oom_kill.c
139 --- linux-2.6.27.10-vs2.3.x-PS-02.0/mm/oom_kill.c 2009-01-25 02:29:32.000000000 +0100
140 +++ linux-2.6.27.10-vs2.3.x-PS-02.1/mm/oom_kill.c 2009-01-25 02:05:07.000000000 +0100
141 @@ -454,6 +454,7 @@ out:
142 read_unlock(&tasklist_lock);
148 static BLOCKING_NOTIFIER_HEAD(oom_notify_list);
149 @@ -519,6 +520,7 @@ void clear_zonelist_oom(struct zonelist
151 spin_unlock(&zone_scan_mutex);
153 +EXPORT_SYMBOL_GPL(clear_zonelist_oom);
156 * out_of_memory - kill the "best" process when we run out of memory
157 @@ -635,4 +637,14 @@ void out_of_memory(struct zonelist *zone
159 spin_unlock(&oom_lock);
162 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
163 +void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask)
166 + panic("Memory cgroup out Of Memory");
171 #endif /* CONFIG_OOM_PANIC */
172 diff -NurpP --exclude '*.orig' --exclude '*.rej' linux-2.6.27.10-vs2.3.x-PS-02.0/mm/page_alloc.c linux-2.6.27.10-vs2.3.x-PS-02.1/mm/page_alloc.c
173 --- linux-2.6.27.10-vs2.3.x-PS-02.0/mm/page_alloc.c 2008-12-19 12:09:14.000000000 +0100
174 +++ linux-2.6.27.10-vs2.3.x-PS-02.1/mm/page_alloc.c 2009-01-25 00:37:42.000000000 +0100
175 @@ -1583,11 +1583,12 @@ nofail_alloc:
178 } else if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) {
179 +#ifdef CONFIG_OOM_KILLER
180 if (!try_set_zone_oom(zonelist, gfp_mask)) {
181 schedule_timeout_uninterruptible(1);
187 * Go through the zonelist yet one more time, keep
188 * very high watermark here, this is only to catch
189 @@ -1598,18 +1599,24 @@ nofail_alloc:
190 order, zonelist, high_zoneidx,
191 ALLOC_WMARK_HIGH|ALLOC_CPUSET);
193 +#ifdef CONFIG_OOM_KILLER
194 clear_zonelist_oom(zonelist, gfp_mask);
199 /* The OOM killer will not help higher order allocs so fail */
200 if (order > PAGE_ALLOC_COSTLY_ORDER) {
201 +#ifdef CONFIG_OOM_KILLER
202 clear_zonelist_oom(zonelist, gfp_mask);
207 out_of_memory(zonelist, gfp_mask, order);
208 +#ifdef CONFIG_OOM_KILLER
209 clear_zonelist_oom(zonelist, gfp_mask);