lkml.org 
[lkml]   [2011]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[patch 3/3] memcg: never OOM when charging huge pages
    Date
    Huge page coverage should obviously have less priority than the
    continued execution of a process.

    Never kill a process when charging it a huge page fails. Instead,
    give up after the first failed reclaim attempt and fall back to
    regular pages.

    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    ---
    mm/memcontrol.c | 10 ++++++++--
    1 files changed, 8 insertions(+), 2 deletions(-)

    diff --git a/mm/memcontrol.c b/mm/memcontrol.c
    index c28072f..9e5de7c 100644
    --- a/mm/memcontrol.c
    +++ b/mm/memcontrol.c
    @@ -2343,13 +2343,19 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
    gfp_t gfp_mask, enum charge_type ctype)
    {
    struct mem_cgroup *mem = NULL;
    + int page_size = PAGE_SIZE;
    struct page_cgroup *pc;
    + bool oom = true;
    int ret;
    - int page_size = PAGE_SIZE;

    if (PageTransHuge(page)) {
    page_size <<= compound_order(page);
    VM_BUG_ON(!PageTransHuge(page));
    + /*
    + * Never OOM-kill a process for a huge page. The
    + * fault handler will fall back to regular pages.
    + */
    + oom = false;
    }

    pc = lookup_page_cgroup(page);
    @@ -2358,7 +2364,7 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
    return 0;
    prefetchw(pc);

    - ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, true, page_size);
    + ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, oom, page_size);
    if (ret || !mem)
    return ret;

    --
    1.7.3.5


    \
     
     \ /
      Last update: 2011-01-31 15:07    [W:0.020 / U:32.768 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site