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

Daisuke Nishimura
2008-10-28T02:06:05Z

> > > /* 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(),
and its ctype is MEM_CGROUP_CHARGE_TYPE_MAPPED so
__mem_cgroup_uncharge_common() is not called at mem_cgroup_end_migration().

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

Thanks,
Daisuke Nishimura.