Skip to contentSkip to conversation

memcg: use existing function to judge root mem cgroup

PATCH In review Wanpeng Li 3 participants 3 messages Jun 22, 2012

Subsystems (3)
lore
Share & tools
lore

Wanpeng Li

author
#0 lore raw

PATCH 1/2 memcg: use existing function to judge root mem cgroup

From: Wanpeng Li <[email protected]>

---
 mm/memcontrol.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +1 -1
index f72b5e5..776fc57 100644
@@ -4873,7 +4873,7 @@ mem_cgroup_create(struct cgroup *cont)
 			goto free_out;
 
 	/* root ? */
-	if (cont->parent == NULL) {
+	if (!(mem_cgroup_is_root(cont))) {
 		int cpu;
 		enable_swap_cgroup();
 		parent = NULL;
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 12 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

---
 mm/memcontrol.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +0 -0
index f72b5e5..776fc57 100644

mm/memcontrol.c mem_cgroup_create(struct cgroup *cont) · line 4876

Quoted 5 lines
mm/memcontrol.c +1 -1
@@ -4873,7 +4873,7 @@ mem_cgroup_create(struct cgroup *cont)
 			goto free_out;
 
 	/* root ? */
-	if (cont->parent == NULL) {
+	if (!(mem_cgroup_is_root(cont))) {

This is not correct. mem_cgroup_is_root takes mem_cgroup and you are giving it cgroup, see?

Quoted 10 lines
mm/memcontrol.c +0 -0
 		int cpu;
 		enable_swap_cgroup();
 		parent = NULL;
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic
maintainer
#2 lore raw
In reply to Wanpeng Li
Quoted 12 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

---
 mm/memcontrol.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +0 -0
index f72b5e5..776fc57 100644

mm/memcontrol.c mem_cgroup_create(struct cgroup *cont) · line 4876

Quoted 5 lines
mm/memcontrol.c +1 -1
@@ -4873,7 +4873,7 @@ mem_cgroup_create(struct cgroup *cont)
 			goto free_out;
 
 	/* root ? */
-	if (cont->parent == NULL) {
+	if (!(mem_cgroup_is_root(cont))) {

cont is struct cgroup *, but this function takes struct mem_cgroup *. The compiler should have warned you about this.