memcg: optimize memcg_get_hierarchical_limit
Subsystems (3)
PATCH v3 3/4 memcg: optimize memcg_get_hierarchical_limit
From: Wanpeng Li <[email protected]>
Optimize memcg_get_hierarchical_limit to save cpu cycle.
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +1 -1
@@ -3917,9 +3917,9 @@ static void memcg_get_hierarchical_limit(struct mem_cgroup *memcg, min_limit =res_counter_read_u64 (&memcg->res,RES_LIMIT ); min_memsw_limit =res_counter_read_u64 (&memcg->memsw,RES_LIMIT ); - cgroup = memcg->css.cgroup;if (!memcg->use_hierarchy) goto out; + cgroup = memcg->css.cgroup;while (cgroup->parent) { cgroup = cgroup->parent;
Signature · 1 line
1.7.9.5
Quoted 3 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Optimize
memcg_get_hierarchical_limitto save cpu cycle.
How did you check that this actually saves some cycles? There are no (compiler) barriers here so it should reordered.
Quoted 23 lines
Signed-off-by Wanpeng Li <[email protected]>--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/memcontrol.c +1
-1@@ -3917,9 +3917,9 @@ static void memcg_get_hierarchical_limit(struct mem_cgroup *memcg, min_limit =res_counter_read_u64 (&memcg->res,RES_LIMIT ); min_memsw_limit =res_counter_read_u64 (&memcg->memsw,RES_LIMIT ); - cgroup = memcg->css.cgroup;if (!memcg->use_hierarchy) goto out; + cgroup = memcg->css.cgroup;while (cgroup->parent) { cgroup = cgroup->parent;Signature · 1 line
1.7.9.5
Signature · 6 lines
Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Optimize
memcg_get_hierarchical_limitto save cpu cycle.Signed-off-by Wanpeng Li <[email protected]>
I can't understand the benefit of this patch to the real world...
So, if you wrote the patch description as "clean up" rather than optimize, ok, I'll agree.
Thanks,
-Kame
Quoted 20 lines
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/memcontrol.c +1
-1@@ -3917,9 +3917,9 @@ static void memcg_get_hierarchical_limit(struct mem_cgroup *memcg, min_limit =res_counter_read_u64 (&memcg->res,RES_LIMIT ); min_memsw_limit =res_counter_read_u64 (&memcg->memsw,RES_LIMIT ); - cgroup = memcg->css.cgroup;if (!memcg->use_hierarchy) goto out; + cgroup = memcg->css.cgroup;while (cgroup->parent) { cgroup = cgroup->parent;
Quoted 11 lines · Kamezawa Hiroyuki
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Optimize
memcg_get_hierarchical_limitto save cpu cycle.Signed-off-by Wanpeng Li <[email protected]>I can't understand the benefit of this patch to the real world...
So, if you wrote the patch description as "clean up" rather than optimize, ok, I'll agree.
OK, I will change to "Cleanup". Thank you Kame.
Best Regards,
Wanpeng Li
Quoted 27 lines
Thanks,
-KameQuoted 20 lines
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/memcontrol.c +1
-1@@ -3917,9 +3917,9 @@ static void memcg_get_hierarchical_limit(struct mem_cgroup *memcg, min_limit =res_counter_read_u64 (&memcg->res,RES_LIMIT ); min_memsw_limit =res_counter_read_u64 (&memcg->memsw,RES_LIMIT ); - cgroup = memcg->css.cgroup;if (!memcg->use_hierarchy) goto out; + cgroup = memcg->css.cgroup;while (cgroup->parent) { cgroup = cgroup->parent;
Quoted 6 lines · Wanpeng Li
Quoted 5 lines · Kamezawa Hiroyuki
Quoted 4 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Optimize
memcg_get_hierarchical_limitto save cpu cycle.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Wanpeng Li <[email protected]>I can't understand the benefit of this patch to the real world...
So, if you wrote the patch description as "clean up" rather than optimize, ok, I'll agree.
OK, I will change to "Cleanup". Thank you Kame.
Does this really clean something up?
Signature · 6 lines
Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic
Quoted 9 lines · Michal Hocko
Quoted 8 lines · Wanpeng Li
Quoted 7 lines · Kamezawa Hiroyuki
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Optimize
memcg_get_hierarchical_limitto save cpu cycle.Signed-off-by Wanpeng Li <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
I can't understand the benefit of this patch to the real world...
So, if you wrote the patch description as "clean up" rather than optimize, ok, I'll agree.
OK, I will change to "Cleanup". Thank you Kame.
Does this really clean something up?
OK, just drop it and resend the patch. Hopefully, you can applied! :-)
Best Regards,
Wanpeng Li
Quoted 7 lines
Signature · 6 lines
Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic
Quoted 9 lines · Michal Hocko
Quoted 8 lines · Wanpeng Li
Quoted 7 lines · Kamezawa Hiroyuki
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Optimize
memcg_get_hierarchical_limitto save cpu cycle.Signed-off-by Wanpeng Li <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
I can't understand the benefit of this patch to the real world...
So, if you wrote the patch description as "clean up" rather than optimize, ok, I'll agree.
OK, I will change to "Cleanup". Thank you Kame.
Does this really clean something up?
I just thought unused variable is trash even if it disappears after complie.
Thanks,
-Kame