[PATCH -mmotm 3/3] memcg: dirty pages instrumentation

Andrea Righi arighi at develer.com
Tue Mar 2 14:18:23 PST 2010


On Tue, Mar 02, 2010 at 07:20:26PM +0530, Balbir Singh wrote:
> * KAMEZAWA Hiroyuki <kamezawa.hiroyu at jp.fujitsu.com> [2010-03-02 17:23:16]:
> 
> > On Tue, 2 Mar 2010 09:01:58 +0100
> > Andrea Righi <arighi at develer.com> wrote:
> > 
> > > On Tue, Mar 02, 2010 at 09:23:09AM +0900, KAMEZAWA Hiroyuki wrote:
> > > > On Mon,  1 Mar 2010 22:23:40 +0100
> > > > Andrea Righi <arighi at develer.com> wrote:
> > > > 
> > > > > Apply the cgroup dirty pages accounting and limiting infrastructure to
> > > > > the opportune kernel functions.
> > > > > 
> > > > > Signed-off-by: Andrea Righi <arighi at develer.com>
> > > > 
> > > > Seems nice.
> > > > 
> > > > Hmm. the last problem is moving account between memcg.
> > > > 
> > > > Right ?
> > > 
> > > Correct. This was actually the last item of the TODO list. Anyway, I'm
> > > still considering if it's correct to move dirty pages when a task is
> > > migrated from a cgroup to another. Currently, dirty pages just remain in
> > > the original cgroup and are flushed depending on the original cgroup
> > > settings. That is not totally wrong... at least moving the dirty pages
> > > between memcgs should be optional (move_charge_at_immigrate?).
> > > 
> > 
> > My concern is 
> >  - migration between memcg is already suppoted
> >     - at task move
> >     - at rmdir
> > 
> > Then, if you leave DIRTY_PAGE accounting to original cgroup,
> > the new cgroup (migration target)'s Dirty page accounting may
> > goes to be negative, or incorrect value. Please check FILE_MAPPED
> > implementation in __mem_cgroup_move_account()
> > 
> > As
> >        if (page_mapped(page) && !PageAnon(page)) {
> >                 /* Update mapped_file data for mem_cgroup */
> >                 preempt_disable();
> >                 __this_cpu_dec(from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
> >                 __this_cpu_inc(to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
> >                 preempt_enable();
> >         }
> > then, FILE_MAPPED never goes negative.
> >
> 
> Absolutely! I am not sure how complex dirty memory migration will be,
> but one way of working around it would be to disable migration of
> charges when the feature is enabled (dirty* is set in the memory
> cgroup). We might need additional logic to allow that to happen. 

I've started to look at dirty memory migration. First attempt is to add
DIRTY, WRITEBACK, etc. to page_cgroup flags and handle them in
__mem_cgroup_move_account(). Probably I'll have something ready for the
next version of the patch. I still need to figure if this can work as
expected...

-Andrea


More information about the Containers mailing list