lkml.org 
[lkml]   [2011]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 6/7] memcg : use better variable name
    rename 'charge_size'at el. to be 'page_size'. Then,

    nr_pages = page_size >> PAGE_SHIFT

    seems natural.

    This patch renames

    charge_size -> page_size
    count -> nr_pages

    etc.



    Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    ---
    mm/memcontrol.c | 28 ++++++++++++++--------------
    1 file changed, 14 insertions(+), 14 deletions(-)

    Index: mmotm-0107/mm/memcontrol.c
    ===================================================================
    --- mmotm-0107.orig/mm/memcontrol.c
    +++ mmotm-0107/mm/memcontrol.c
    @@ -1705,7 +1705,7 @@ static void drain_local_stock(struct wor
    * Cache charges(val) which is from res_counter, to local per_cpu area.
    * This will be consumed by consume_stock() function, later.
    */
    -static void refill_stock(struct mem_cgroup *mem, int val)
    +static void refill_stock(struct mem_cgroup *mem, int page_size)
    {
    struct memcg_stock_pcp *stock = &get_cpu_var(memcg_stock);

    @@ -1713,7 +1713,7 @@ static void refill_stock(struct mem_cgro
    drain_stock(stock);
    stock->cached = mem;
    }
    - stock->charge += val;
    + stock->charge += page_size;
    put_cpu_var(memcg_stock);
    }

    @@ -2037,12 +2037,12 @@ bypass:
    * gotten by try_charge().
    */
    static void __mem_cgroup_cancel_charge(struct mem_cgroup *mem,
    - unsigned long count)
    + unsigned long nr_pages)
    {
    if (!mem_cgroup_is_root(mem)) {
    - res_counter_uncharge(&mem->res, PAGE_SIZE * count);
    + res_counter_uncharge(&mem->res, PAGE_SIZE * nr_pages);
    if (do_swap_account)
    - res_counter_uncharge(&mem->memsw, PAGE_SIZE * count);
    + res_counter_uncharge(&mem->memsw, PAGE_SIZE * nr_pages);
    }
    }

    @@ -2255,9 +2255,9 @@ out:

    static void __mem_cgroup_move_account(struct page_cgroup *pc,
    struct mem_cgroup *from, struct mem_cgroup *to, bool uncharge,
    - int charge_size)
    + int page_size)
    {
    - int nr_pages = charge_size >> PAGE_SHIFT;
    + int nr_pages = page_size >> PAGE_SHIFT;

    VM_BUG_ON(from == to);
    VM_BUG_ON(PageLRU(pc->page));
    @@ -2275,7 +2275,7 @@ static void __mem_cgroup_move_account(st
    mem_cgroup_charge_statistics(from, PageCgroupCache(pc), -nr_pages);
    if (uncharge)
    /* This is not "cancel", but cancel_charge does all we need. */
    - mem_cgroup_cancel_charge(from, charge_size);
    + mem_cgroup_cancel_charge(from, page_size);

    /* caller should have done css_get */
    pc->mem_cgroup = to;
    @@ -2295,18 +2295,18 @@ static void __mem_cgroup_move_account(st
    */
    static int mem_cgroup_move_account(struct page_cgroup *pc,
    struct mem_cgroup *from, struct mem_cgroup *to,
    - bool uncharge, int charge_size)
    + bool uncharge, int page_size)
    {
    int ret = -EINVAL;
    unsigned long flags;

    - if ((charge_size > PAGE_SIZE) && !PageTransHuge(pc->page))
    + if ((page_size > PAGE_SIZE) && !PageTransHuge(pc->page))
    return -EBUSY;

    lock_page_cgroup(pc);
    if (PageCgroupUsed(pc) && pc->mem_cgroup == from) {
    move_lock_page_cgroup(pc, &flags);
    - __mem_cgroup_move_account(pc, from, to, uncharge, charge_size);
    + __mem_cgroup_move_account(pc, from, to, uncharge, page_size);
    move_unlock_page_cgroup(pc, &flags);
    ret = 0;
    }
    @@ -2645,7 +2645,7 @@ direct_uncharge:
    static struct mem_cgroup *
    __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
    {
    - int count;
    + int nr_pages;
    struct page_cgroup *pc;
    struct mem_cgroup *mem = NULL;
    int page_size = PAGE_SIZE;
    @@ -2661,7 +2661,7 @@ __mem_cgroup_uncharge_common(struct page
    VM_BUG_ON(!PageTransHuge(page));
    }

    - count = page_size >> PAGE_SHIFT;
    + nr_pages = page_size >> PAGE_SHIFT;
    /*
    * Check if our page_cgroup is valid
    */
    @@ -2694,7 +2694,7 @@ __mem_cgroup_uncharge_common(struct page
    break;
    }

    - mem_cgroup_charge_statistics(mem, PageCgroupCache(pc), -count);
    + mem_cgroup_charge_statistics(mem, PageCgroupCache(pc), -nr_pages);

    ClearPageCgroupUsed(pc);
    /*


    \
     
     \ /
      Last update: 2011-01-21 07:57    [W:0.028 / U:92.668 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site