lkml.org 
[lkml]   [2010]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] oom_kill: set default process to kill
From
---
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;

\
 
 \ /
  Last update: 2010-03-16 15:11    [W:0.126 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site