Suspend 2 merge:L 12/51: Disable OOM killer when suspending.

Nigel Cunningham
2004-11-24T13:04:35Z

When preparing the image, suspend eats all the memory in sight, both to
reduce the image size and to improve the reliability of our stats (We've
worked hard to make it work reliably under heavy load - 100+). Of course
this can result in the OOM killer being triggered, so this simple test
stops that happening.

diff -ruN 501-disable-oom-killer-when-suspending-old/mm/oom_kill.c 501-disable-oom-killer-when-suspending-new/mm/oom_kill.c
--- 501-disable-oom-killer-when-suspending-old/mm/oom_kill.c 2004-11-03 21:53:47.000000000 +1100
+++ 501-disable-oom-killer-when-suspending-new/mm/oom_kill.c 2004-11-04 16:27:40.000000000 +1100
@@ -20,6 +20,7 @@
#include <linux/swap.h>
#include <linux/timex.h>
#include <linux/jiffies.h>
+#include <linux/suspend.h>

/* #define DEBUG */

@@ -237,6 +238,9 @@
static unsigned long first, last, count, lastkill;
unsigned long now, since;

+ if (test_suspend_state(SUSPEND_FREEZER_ON))
+ return;
+
spin_lock(&oom_lock);
now = jiffies;
since = now - last;