lkml.org 
[lkml]   [2009]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 10/11 -mmotm] oom: avoid oom kill if no interruptible tasks
    If there are no interruptible system tasks other than kthreads, no task
    should be chosen for oom kill since they won't respond to the SIGKILL
    anyway. Instead, we choose to simply fail page allocations if reclaim
    cannot free memory and hope for the best.

    Signed-off-by: David Rientjes <rientjes@google.com>
    ---
    mm/oom_kill.c | 5 ++++-
    1 files changed, 4 insertions(+), 1 deletions(-)

    diff --git a/mm/oom_kill.c b/mm/oom_kill.c
    --- a/mm/oom_kill.c
    +++ b/mm/oom_kill.c
    @@ -209,6 +209,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
    struct task_struct *g, *p;
    struct task_struct *chosen = NULL;
    struct timespec uptime;
    + unsigned long nr_interruptible = 0;
    *ppoints = 0;
    *freed = 0;

    @@ -225,6 +226,8 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
    /* skip the init task */
    if (is_global_init(p))
    continue;
    + if (!(p->state & TASK_UNINTERRUPTIBLE))
    + nr_interruptible++;
    if (mem && !task_in_mem_cgroup(p, mem))
    continue;

    @@ -277,7 +280,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
    }
    } while_each_thread(g, p);

    - return chosen;
    + return nr_interruptible ? chosen : ERR_PTR(-1UL);
    }

    /**

    \
     
     \ /
      Last update: 2009-05-11 00:13    [W:0.030 / U:93.912 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site