lkml.org 
[lkml]   [2010]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH]oom-kill: direct hardware access processes should get bonus
    From
    Date

    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;

    /*



    \
     
     \ /
      Last update: 2010-11-02 02:47    [W:7.415 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site