Re: [RFC][PATCH 11/11] memcg: mem+swap controler core

KAMEZAWA Hiroyuki
2008-10-28T02:31:00Z

On Tue, 28 Oct 2008 11:06:05 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:

> > > > /* This happens at race in zap_pte_range() and do_swap_page()*/
> > > > unlock_page_cgroup(pc);
> > > > - return;
> > > > + return NULL;
> > > > }
> > > > ClearPageCgroupUsed(pc);
> > > > mem = pc->mem_cgroup;
> > > > @@ -1063,9 +1197,11 @@ __mem_cgroup_uncharge_common(struct page
> > > > * unlock this.
> > > > */
> > > > res_counter_uncharge(&mem->res, PAGE_SIZE);
> > > > + if (do_swap_account && ctype != MEM_CGROUP_CHARGE_TYPE_SWAPOUT)
> > > > + res_counter_uncharge(&mem->memsw, PAGE_SIZE);
> > > > unlock_page_cgroup(pc);
> > > > release_page_cgroup(pc);
> > > > - return;
> > > > + return mem;
> > > > }
> > > >
> > > Now, anon pages are not uncharge if PageSwapCache,
> > > I think "if (unused && ctype != MEM_CGROUP_CHARGE_TYPE_MAPPED)" at
> > > mem_cgroup_end_migration() should be removed. Otherwise oldpage
> > > is not uncharged if it is on swapcache, isn't it?
> > >
> > oldpage's swapcache bit is dropped at that stage.
> > I'll add comment.
> >
> I'm sorry if I misunderstand something.
>
> Oldpage(anon on swapcache) isn't uncharged via try_to_unmap(),
yes.
> and its ctype is MEM_CGROUP_CHARGE_TYPE_MAPPED so
yes.
> __mem_cgroup_uncharge_common() is not called at mem_cgroup_end_migration().
>
Ah, I see.

> I think "if (unused && ctype != MEM_CGROUP_CHARGE_TYPE_MAPPED)" in
> mem_cgroup_end_migration() is not needed. PCG_USED flag prevents double uncharging.
>
will fix.

Thanks,
-Kame

>
> Thanks,
> Daisuke Nishimura.