From 467c2912c01d345c03818bf1c0b177b17742a1b3 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Fri, 13 Apr 2012 08:52:03 +1000 Subject: [PATCH] memcg swap: use mem_cgroup_uncharge_swap() That stuff __mem_cgroup_commit_charge_swapin() does with a swap entry, it has a name and even a declaration: just use mem_cgroup_uncharge_swap(). Signed-off-by: Hugh Dickins Acked-by: KAMEZAWA Hiroyuki Cc: Daisuke Nishimura Acked-by: Johannes Weiner Cc: Michal Hocko Signed-off-by: Andrew Morton --- mm/memcontrol.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e4bc62e3f903..90641962efbd 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2850,24 +2850,7 @@ __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *memcg, */ if (do_swap_account && PageSwapCache(page)) { swp_entry_t ent = {.val = page_private(page)}; - struct mem_cgroup *swap_memcg; - unsigned short id; - - id = swap_cgroup_record(ent, 0); - rcu_read_lock(); - swap_memcg = mem_cgroup_lookup(id); - if (swap_memcg) { - /* - * This recorded memcg can be obsolete one. So, avoid - * calling css_tryget - */ - if (!mem_cgroup_is_root(swap_memcg)) - res_counter_uncharge(&swap_memcg->memsw, - PAGE_SIZE); - mem_cgroup_swap_statistics(swap_memcg, false); - mem_cgroup_put(swap_memcg); - } - rcu_read_unlock(); + mem_cgroup_uncharge_swap(ent); } /* * At swapin, we may charge account against cgroup which has no tasks. -- 2.39.5