Thread (14 messages) 14 messages, 3 authors, 2014-10-08

Re: [patch 1/3] mm: memcontrol: take a css reference for each charged page

From: Michal Hocko <hidden>
Date: 2014-10-08 13:29:30
Also in: cgroups, lkml

On Wed 08-10-14 15:27:54, Michal Hocko wrote:
On Sat 20-09-14 16:00:33, Johannes Weiner wrote:
[...]
quoted
@@ -2803,8 +2808,10 @@ static void memcg_uncharge_kmem(struct mem_cgroup *memcg,
 		page_counter_uncharge(&memcg->memsw, nr_pages);
 
Wouldn't a single out_css_put be more readable? I was quite confused
when I start reading the patch before I saw the next hunk.
Ohh, this will go away in the next patch. Ignore this.
quoted
 	/* Not down to 0 */
-	if (page_counter_uncharge(&memcg->kmem, nr_pages))
		goto out_css_put;
quoted
+	if (page_counter_uncharge(&memcg->kmem, nr_pages)) {
+		css_put_many(&memcg->css, nr_pages);
 		return;
+	}
 
 	/*
 	 * Releases a reference taken in kmem_cgroup_css_offline in case
@@ -2816,6 +2823,8 @@ static void memcg_uncharge_kmem(struct mem_cgroup *memcg,
 	 */
 	if (memcg_kmem_test_and_clear_dead(memcg))
 		css_put(&memcg->css);
+
out_css_put:
quoted
+	css_put_many(&memcg->css, nr_pages);
 }
 
 /*
-- 
Michal Hocko
SUSE Labs
-- 
Michal Hocko
SUSE Labs

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help