linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memcg swap: use mem_cgroup_uncharge_swap
@ 2012-03-23 20:54 Hugh Dickins
  2012-03-24  0:29 ` Johannes Weiner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hugh Dickins @ 2012-03-23 20:54 UTC (permalink / raw)
  To: Andrew Morton
  Cc: KAMEZAWA Hiroyuki, Daisuke Nishimura, Johannes Weiner,
	Michal Hocko, linux-mm

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 <hughd@google.com>
---

 mm/memcontrol.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

--- linux.git/mm/memcontrol.c	2012-03-23 10:19:53.576051635 -0700
+++ linux/mm/memcontrol.c	2012-03-23 10:51:03.996092671 -0700
@@ -2850,24 +2850,7 @@ __mem_cgroup_commit_charge_swapin(struct
 	 */
 	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.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-05 14:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 20:54 [PATCH] memcg swap: use mem_cgroup_uncharge_swap Hugh Dickins
2012-03-24  0:29 ` Johannes Weiner
2012-03-26  1:13 ` KAMEZAWA Hiroyuki
2012-04-05  3:19 ` [patch] memcg swap: use mem_cgroup_uncharge_swap fix David Rientjes
2012-04-05 14:49   ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox