lkml.org 
[lkml]   [2012]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch 09/11] mm: memcg: split swapin charge function into private and public part
    On Thu 05-07-12 02:45:01, Johannes Weiner wrote:
    > When shmem is charged upon swapin, it does not need to check twice
    > whether the memory controller is enabled.
    >
    > Also, shmem pages do not have to be checked for everything that
    > regular anon pages have to be checked for, so let shmem use the
    > internal version directly and allow future patches to move around
    > checks that are only required when swapping in anon pages.
    >
    > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

    Acked-by: Michal Hocko <mhocko@suse.cz>

    > ---
    > mm/memcontrol.c | 24 +++++++++++++++---------
    > 1 files changed, 15 insertions(+), 9 deletions(-)
    >
    > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
    > index 6fe4101..a8bf86a 100644
    > --- a/mm/memcontrol.c
    > +++ b/mm/memcontrol.c
    > @@ -2734,18 +2734,14 @@ int mem_cgroup_newpage_charge(struct page *page,
    > * struct page_cgroup is acquired. This refcnt will be consumed by
    > * "commit()" or removed by "cancel()"
    > */
    > -int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
    > - struct page *page,
    > - gfp_t mask, struct mem_cgroup **memcgp)
    > +static int __mem_cgroup_try_charge_swapin(struct mm_struct *mm,
    > + struct page *page,
    > + gfp_t mask,
    > + struct mem_cgroup **memcgp)
    > {
    > struct mem_cgroup *memcg;
    > int ret;
    >
    > - *memcgp = NULL;
    > -
    > - if (mem_cgroup_disabled())
    > - return 0;
    > -
    > if (!do_swap_account)
    > goto charge_cur_mm;
    > /*
    > @@ -2772,6 +2768,15 @@ int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
    > return ret;
    > }
    >
    > +int mem_cgroup_try_charge_swapin(struct mm_struct *mm, struct page *page,
    > + gfp_t gfp_mask, struct mem_cgroup **memcgp)
    > +{
    > + *memcgp = NULL;
    > + if (mem_cgroup_disabled())
    > + return 0;
    > + return __mem_cgroup_try_charge_swapin(mm, page, gfp_mask, memcgp);
    > +}
    > +
    > void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg)
    > {
    > if (mem_cgroup_disabled())
    > @@ -2833,7 +2838,8 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
    > if (!PageSwapCache(page))
    > ret = mem_cgroup_charge_common(page, mm, gfp_mask, type);
    > else { /* page is swapcache/shmem */
    > - ret = mem_cgroup_try_charge_swapin(mm, page, gfp_mask, &memcg);
    > + ret = __mem_cgroup_try_charge_swapin(mm, page,
    > + gfp_mask, &memcg);
    > if (!ret)
    > __mem_cgroup_commit_charge_swapin(page, memcg, type);
    > }
    > --
    > 1.7.7.6
    >

    --
    Michal Hocko
    SUSE Labs
    SUSE LINUX s.r.o.
    Lihovarska 1060/12
    190 00 Praha 9
    Czech Republic


    \
     
     \ /
      Last update: 2012-07-09 18:01    [W:0.027 / U:0.144 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site