Skip to contentSkip to conversation

memcg: clean up checking of the disabled flag

PATCH In review Li Zefan 4 participants 4 messages Jun 6, 2008 – Jun 7, 2008

Subsystems (2)
lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 memcg: clean up checking of the disabled flag

Those checks are unnecessary, because when the subsystem is disabled it can't be mounted, so those functions won't get called.

The check is needed in functions which will be called in other places except cgroup.

---
 memcontrol.c |    8 --------
 1 file changed, 8 deletions(-)
mm/memcontrol.c +0 -8
@@ -845,9 +845,6 @@ static int mem_cgroup_force_empty(struct
 	int ret = -EBUSY;
 	int node, zid;
 
-	if (mem_cgroup_subsys.disabled)
-		return 0;
-
 	css_get(&mem->css);
 	/*
 	 * page reclaim code (kswapd etc..) will move pages between
@@ -1105,8 +1102,6 @@ static void mem_cgroup_destroy(struct cg
 static int mem_cgroup_populate(struct cgroup_subsys *ss,
 				struct cgroup *cont)
 {
-	if (mem_cgroup_subsys.disabled)
-		return 0;
 	return cgroup_add_files(cont, ss, mem_cgroup_files,
 					ARRAY_SIZE(mem_cgroup_files));
 }
@@ -1119,9 +1114,6 @@ static void mem_cgroup_move_task(struct 
 	struct mm_struct *mm;
 	struct mem_cgroup *mem, *old_mem;
 
-	if (mem_cgroup_subsys.disabled)
-		return;
-
 	mm = get_task_mm(p);
 	if (mm == NULL)
 		return;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Fri, 06 Jun 2008 09:39:41 +0800 Li Zefan <[email protected]> wrote:

Those checks are unnecessary, because when the subsystem is disabled it can't be mounted, so those functions won't get called.

The check is needed in functions which will be called in other places except cgroup.

Good catch!

Acked-by on v1 1/1
#2 lore raw
In reply to Li Zefan
Quoted 7 lines · Li Zefan

Those checks are unnecessary, because when the subsystem is disabled it can't be mounted, so those functions won't get called.

The check is needed in functions which will be called in other places except cgroup.

Yep, that should work

Signature · 10 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 1/1
#3 lore raw
In reply to Li Zefan
Quoted 7 lines

Those checks are unnecessary, because when the subsystem is disabled it can't be mounted, so those functions won't get called.

The check is needed in functions which will be called in other places except cgroup.

nice.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>