[PATCH] oom_kill: set default process to kill

From: Bob Sleigh
Date: Tue Mar 16 2010 - 10:09:03 EST


---
mm/Kconfig | 9 +++++++++
mm/oom_kill.c | 10 ++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/mm/Kconfig b/mm/Kconfig
index 9c61158..3911730 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -287,3 +287,12 @@ config NOMMU_INITIAL_TRIM_EXCESS
of 1 says that all excess pages should be trimmed.

See Documentation/nommu-mmap.txt for more information.
+
+config MM_USUAL_SUSPECT
+ string "Default executable name to be killed by the OOM killer"
+ default ""
+ help
+ This option sets the default executable name to be killed when we run
+ out of memory.
+
+ If unsure, set to "firefox-bin".
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 35755a4..333fa46 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -300,6 +300,16 @@ static struct task_struct
*select_bad_process(unsigned long *ppoints,
if (p->signal->oom_adj == OOM_DISABLE)
continue;

+#ifdef CONFIG_MM_USUAL_SUSPECT
+ /*
+ * Select the task if matching the usual suspect.
+ */
+ if (strcmp(p->comm, CONFIG_MM_USUAL_SUSPECT)) {
+ chosen = p;
+ continue;
+ }
+#endif
+
points = badness(p, uptime.tv_sec);
if (points > *ppoints || !chosen) {
chosen = p;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/