[PATH] Trigger OOM handler through sysrq

Justin A (justin@bouncybouncy.net)
Thu, 16 Aug 2001 23:36:13 -0400


The below patch allows you to trigger the OOM handler rather then the
generic SAK. This may very well be the wrong way to do things, but
I'm sure someone else will know the right way to do this. Apply this
if you want to try another way of bringing back a thrashing system.

Thanks,
-Justin

diff -urP sysrq.c.orig sysrq.c -u
--- sysrq.c.orig Thu Aug 16 23:22:18 2001
+++ sysrq.c Thu Aug 16 23:24:01 2001
@@ -23,6 +23,7 @@
#include <linux/quotaops.h>
#include <linux/smp_lock.h>
#include <linux/module.h>
+#include <linux/swap.h>

#include <asm/ptrace.h>

@@ -137,6 +138,11 @@
send_sig_all(SIGKILL, 1);
orig_log_level = 8;
break;
+ case 'f': /* F -- Free memory by invoking the oom handler */
+ printk("Free memory -- oom_kill()\n");
+ oom_kill();
+ break;
+
default: /* Unknown: help */
if (kbd)
printk("unRaw ");
@@ -147,7 +153,7 @@
printk("Boot ");
if (sysrq_power_off)
printk("Off ");
- printk("Sync Unmount showPc showTasks showMem loglevel0-8 tErm kIll killalL\n");
+ printk("Sync Unmount showPc showTasks showMem loglevel0-8 tErm kIll killalL Freemem\n");
/* Don't use 'A' as it's handled specially on the Sparc */
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/