lkml.org 
[lkml]   [2011]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[RFC][PATCH 5/7] memcg : export select victim memcg
    Later change will call mem_cgroup_select_victim() from vmscan.c
    to do hierarchical reclaim. Need to export an interface and add
    release_victim().

    Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    ---
    include/linux/memcontrol.h | 2 ++
    mm/memcontrol.c | 13 +++++++++----
    2 files changed, 11 insertions(+), 4 deletions(-)

    Index: mmotm-May6/mm/memcontrol.c
    ===================================================================
    --- mmotm-May6.orig/mm/memcontrol.c
    +++ mmotm-May6/mm/memcontrol.c
    @@ -1555,6 +1555,11 @@ mem_cgroup_select_victim(struct mem_cgro
    return ret;
    }

    +void mem_cgroup_release_victim(struct mem_cgroup *mem)
    +{
    + css_put(&mem->css);
    +}
    +
    #if MAX_NUMNODES > 1

    /*
    @@ -1699,7 +1704,7 @@ static int mem_cgroup_hierarchical_recla
    * no reclaimable pages under this hierarchy
    */
    if (!check_soft || !total) {
    - css_put(&victim->css);
    + mem_cgroup_release_victim(victim);
    break;
    }
    /*
    @@ -1710,14 +1715,14 @@ static int mem_cgroup_hierarchical_recla
    */
    if (total >= (excess >> 2) ||
    (loop > MEM_CGROUP_MAX_RECLAIM_LOOPS)) {
    - css_put(&victim->css);
    + mem_cgroup_release_victim(victim);
    break;
    }
    }
    }
    if (!mem_cgroup_local_usage(victim)) {
    /* this cgroup's local usage == 0 */
    - css_put(&victim->css);
    + mem_cgroup_release_victim(victim);
    continue;
    }
    /* we use swappiness of local cgroup */
    @@ -1730,7 +1735,7 @@ static int mem_cgroup_hierarchical_recla
    } else
    ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
    noswap);
    - css_put(&victim->css);
    + mem_cgroup_release_victim(victim);
    /*
    * At shrinking usage, we can't check we should stop here or
    * reclaim more. It's depends on callers. last_scanned_child
    Index: mmotm-May6/include/linux/memcontrol.h
    ===================================================================
    --- mmotm-May6.orig/include/linux/memcontrol.h
    +++ mmotm-May6/include/linux/memcontrol.h
    @@ -122,6 +122,8 @@ struct zone_reclaim_stat*
    mem_cgroup_get_reclaim_stat_from_page(struct page *page);
    extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
    struct task_struct *p);
    +struct mem_cgroup *mem_cgroup_select_victim(struct mem_cgroup *mem);
    +void mem_cgroup_release_victim(struct mem_cgroup *mem);
    #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
    extern int do_swap_account;
    #endif


    \
     
     \ /
      Last update: 2011-05-10 12:19    [W:0.134 / U:1.556 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site