Re: [PATCH -mmotm 2/3] memcg: cleanup mem_cgroup_move_parent()

Daisuke Nishimura
2009-11-11T15:16:53Z

On Wed, 11 Nov 2009 20:10:50 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> * nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2009-11-11 10:37:41]:
>
> > mem_cgroup_move_parent() calls try_charge first and cancel_charge on failure.
> > IMHO, charge/uncharge(especially charge) is high cost operation, so we should
> > avoid it as far as possible.
> >
>
> But cancel_charge and move_account are not frequent operations, does
> optimizing this give a significant benefit?
>
I agree they are not called so frequently, so the benefit would not be so big.
But, the number of lines of memcontrol.c decreases a bit by these patches ;)

IMHO, current mem_cgroup_move_parent() is a bit hard to understand, and mem_cgroup_move_account() have redundant codes. So, I cleaned them up.

Moreover, mem_cgroup_cancel_charge(), which I introduced in [1/3], and the new
wrapper function of mem_cgroup_move_account(), which I introduced in this patch,
will be used in my recharge-at-task-move patches and make them more readable.

> Looks good overall
>
Thank you.

Daisuke Nishimura.