* [PATCH] mm/memcg: remove redundant checking on root memcg
@ 2012-07-17 9:42 Wanpeng Li
2012-07-17 10:56 ` Michal Hocko
0 siblings, 1 reply; 2+ messages in thread
From: Wanpeng Li @ 2012-07-17 9:42 UTC (permalink / raw)
To: linux-mm
Cc: Michal Hocko, Johannes Weiner, KAMEZAWA Hiroyuki, cgroups,
linux-kernel, Gavin Shan, Wanpeng Li
Function __mem_cgroup_cancel_local_charge is only called by
mem_cgroup_move_parent. For this case, root memcg has been
checked by mem_cgroup_move_parent. So we needn't check that
again in function __mem_cgroup_cancel_local_charge and just
remove the check in function __mem_cgroup_cancel_local_charge.
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
mm/memcontrol.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6392c0a..d346347 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2404,9 +2404,6 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
{
unsigned long bytes = nr_pages * PAGE_SIZE;
- if (mem_cgroup_is_root(memcg))
- return;
-
res_counter_uncharge_until(&memcg->res, memcg->res.parent, bytes);
if (do_swap_account)
res_counter_uncharge_until(&memcg->memsw,
--
1.7.5.4
--
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>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/memcg: remove redundant checking on root memcg
2012-07-17 9:42 [PATCH] mm/memcg: remove redundant checking on root memcg Wanpeng Li
@ 2012-07-17 10:56 ` Michal Hocko
0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2012-07-17 10:56 UTC (permalink / raw)
To: Wanpeng Li
Cc: linux-mm, Johannes Weiner, KAMEZAWA Hiroyuki, cgroups,
linux-kernel, Gavin Shan
On Tue 17-07-12 17:42:27, Wanpeng Li wrote:
> Function __mem_cgroup_cancel_local_charge is only called by
> mem_cgroup_move_parent. For this case, root memcg has been
> checked by mem_cgroup_move_parent. So we needn't check that
> again in function __mem_cgroup_cancel_local_charge and just
> remove the check in function __mem_cgroup_cancel_local_charge.
It's true that the check is not necessary but on the other hand
__mem_cgroup_cancel_charge does check it and it would be unfortunate to
have two very similar functions with different expectations (one can be
called for the root cgroup while other one cannot).
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> ---
> mm/memcontrol.c | 3 ---
> 1 files changed, 0 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 6392c0a..d346347 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2404,9 +2404,6 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
> {
> unsigned long bytes = nr_pages * PAGE_SIZE;
>
> - if (mem_cgroup_is_root(memcg))
> - return;
> -
> res_counter_uncharge_until(&memcg->res, memcg->res.parent, bytes);
> if (do_swap_account)
> res_counter_uncharge_until(&memcg->memsw,
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe cgroups" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-17 10:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 9:42 [PATCH] mm/memcg: remove redundant checking on root memcg Wanpeng Li
2012-07-17 10:56 ` Michal Hocko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).