linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]oom-kill: direct hardware access processes should get bonus
@ 2010-11-02  1:43 Figo.zhang
  2010-11-02  3:10 ` David Rientjes
                   ` (3 more replies)
  0 siblings, 4 replies; 45+ messages in thread
From: Figo.zhang @ 2010-11-02  1:43 UTC (permalink / raw)
  To: lkml, linux-mm, Andrew Morton, rientjes


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.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
---
mm/oom_kill.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 4029583..df6a9da 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -195,10 +195,12 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
 	task_unlock(p);
 
 	/*
-	 * Root processes get 3% bonus, just like the __vm_enough_memory()
-	 * implementation used by LSMs.
+	 * Root and direct hardware access processes get 3% bonus, just like the
+	 * __vm_enough_memory() implementation used by LSMs.
 	 */
-	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;
 
 	/*



^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2011-01-06  1:01 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02  1:43 [PATCH]oom-kill: direct hardware access processes should get bonus Figo.zhang
2010-11-02  3:10 ` David Rientjes
2010-11-02 14:24   ` Figo.zhang
2010-11-02 19:34     ` David Rientjes
2010-11-03 23:43 ` [PATCH v2]oom-kill: CAP_SYS_RESOURCE " Figo.zhang
2010-11-03 23:47   ` David Rientjes
     [not found]     ` <AANLkTimjfmLzr_9+Sf4gk0xGkFjffQ1VcCnwmCXA88R8@mail.gmail.com>
2010-11-04  1:38       ` Figo.zhang
2010-11-04  1:50         ` David Rientjes
2010-11-04  2:12           ` Figo.zhang
2010-11-04  2:54             ` David Rientjes
2010-11-04  4:42               ` Figo.zhang
2010-11-04  5:08                 ` David Rientjes
2010-11-09 11:01           ` [PATCH " KOSAKI Motohiro
2010-11-09 12:24             ` Alan Cox
2010-11-09 21:06               ` David Rientjes
2010-11-09 21:25                 ` David Rientjes
2010-11-10 14:38                 ` Figo.zhang
2010-11-10 20:50                   ` David Rientjes
2010-11-09 10:41 ` [PATCH]oom-kill: direct hardware access processes " KOSAKI Motohiro
2010-11-09 12:24 ` [PATCH v2]mm/oom-kill: " Figo.zhang
2010-11-09 21:16   ` David Rientjes
2010-11-10 14:48     ` Figo.zhang
2010-11-14  5:07     ` KOSAKI Motohiro
2010-11-14 21:29       ` David Rientjes
2010-11-15  1:24         ` KOSAKI Motohiro
2010-11-15 10:03           ` David Rientjes
2010-11-23  7:16             ` KOSAKI Motohiro
2010-11-28  1:36               ` David Rientjes
2010-11-30 13:00                 ` KOSAKI Motohiro
2010-11-30 20:05                   ` David Rientjes
2010-11-10 15:14   ` [PATCH v3]mm/oom-kill: " Figo.zhang
2010-11-10 15:24     ` Figo.zhang
2010-11-10 21:00       ` David Rientjes
2010-11-14  5:21       ` KOSAKI Motohiro
2010-11-14 21:33         ` David Rientjes
2010-11-15  3:26           ` [PATCH] Revert oom rewrite series Figo.zhang
2010-11-15 10:14             ` David Rientjes
2010-11-15 10:57               ` Alan Cox
2010-11-15 20:54                 ` David Rientjes
2010-11-23  7:16                 ` KOSAKI Motohiro
2011-01-04  7:51       ` [PATCH v3]mm/oom-kill: direct hardware access processes should get bonus Figo.zhang
2011-01-04  8:28         ` KAMEZAWA Hiroyuki
2011-01-04  8:56           ` Figo.zhang
2011-01-06  0:55             ` KAMEZAWA Hiroyuki
2011-01-05  3:32         ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).