lkml.org 
[lkml]   [2010]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH v2]mm/oom-kill: direct hardware access processes should get bonus
From"Figo.zhang" <>
DateTue, 09 Nov 2010 20:24:28 +0800

the victim should not directly access hardware devices like Xorg server,
because the hardware could be left in an unpredictable state, although
user-application can set /proc/pid/oom_score_adj to protect it. so i think
those processes should get 3% bonus for protection.

in v2, fix the incorrect comment.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
mm/oom_kill.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 4029583..9b06f56 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -196,9 +196,12 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,

/*
* Root processes get 3% bonus, just like the __vm_enough_memory()
- * implementation used by LSMs.
+ * implementation used by LSMs. And direct hardware access processes
+ * also get 3% bonus.
*/
- if (has_capability_noaudit(p, CAP_SYS_ADMIN))
+ if (has_capability_noaudit(p, CAP_SYS_ADMIN) ||
+ has_capability_noaudit(p, CAP_SYS_RESOURCE) ||
+ has_capability_noaudit(p, CAP_SYS_RAWIO))
points -= 30;

/*



\
 
 \ /
  Last update: 2010-11-09 13:27    [from the cache]
©2003-2010