linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"Kirill A. Shutemov" <kirill@shutemov.name>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/2] memcg : update softlimit and threshold at commit.
Date: Fri, 12 Feb 2010 16:42:01 +0900	[thread overview]
Message-ID: <20100212164201.2ec8f0ff.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20100212163311.7fe3d879.nishimura@mxp.nes.nec.co.jp>

On Fri, 12 Feb 2010 16:33:11 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:

> On Fri, 12 Feb 2010 15:47:13 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > Now, move_task introduced "batched" precharge. Because res_counter or css's refcnt
> > are not-scalable jobs for memcg, charge()s should be done in batched manner
> > if allowed.
> > 
> > Now, softlimit and threshold check their event counter in try_charge, but
> > this charge() is not per-page event. And event counter is not updated at charge().
> > Moreover, precharge doesn't pass "page" to try_charge() and softlimit tree
> > will be never updated until uncharge() causes an event.
> > 
> > So, the best place to check the event counter is commit_charge(). This is 
> > per-page event by its nature. This patch move checks to there.
> > 
> I agree to this direction.
> 
> > Cc: Kirill A. Shutemov <kirill@shutemov.name>
> > Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
> > Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > ---
> >  mm/memcontrol.c |   23 ++++++++++++-----------
> >  1 file changed, 12 insertions(+), 11 deletions(-)
> > 
> > Index: mmotm-2.6.33-Feb10/mm/memcontrol.c
> > ===================================================================
> > --- mmotm-2.6.33-Feb10.orig/mm/memcontrol.c
> > +++ mmotm-2.6.33-Feb10/mm/memcontrol.c
> > @@ -1463,7 +1463,7 @@ static int __mem_cgroup_try_charge(struc
> >  		unsigned long flags = 0;
> >  
> >  		if (consume_stock(mem))
> > -			goto charged;
> > +			goto done;
> >  
> >  		ret = res_counter_charge(&mem->res, csize, &fail_res);
> >  		if (likely(!ret)) {
> > @@ -1558,16 +1558,7 @@ static int __mem_cgroup_try_charge(struc
> >  	}
> >  	if (csize > PAGE_SIZE)
> >  		refill_stock(mem, csize - PAGE_SIZE);
> > -charged:
> > -	/*
> > -	 * Insert ancestor (and ancestor's ancestors), to softlimit RB-tree.
> > -	 * if they exceeds softlimit.
> > -	 */
> > -	if (page && mem_cgroup_soft_limit_check(mem))
> > -		mem_cgroup_update_tree(mem, page);
> >  done:
> > -	if (mem_cgroup_threshold_check(mem))
> > -		mem_cgroup_threshold(mem);
> >  	return 0;
> >  nomem:
> >  	css_put(&mem->css);
> After this change, @page can be removed from the arg of try_charge().
> 
Ah, hmm. good point. Will update.

Thanks,
-Kame


> 
> Thanks,
> Daisuke Nishimura.
> 
> > @@ -1691,6 +1682,16 @@ static void __mem_cgroup_commit_charge(s
> >  	mem_cgroup_charge_statistics(mem, pc, true);
> >  
> >  	unlock_page_cgroup(pc);
> > +	/*
> > +	 * "charge_statistics" updated event counter. Then, check it.
> > +	 * Insert ancestor (and ancestor's ancestors), to softlimit RB-tree.
> > +	 * if they exceeds softlimit.
> > +	 */
> > +	if (mem_cgroup_soft_limit_check(mem))
> > +		mem_cgroup_update_tree(mem, pc->page);
> > +	if (mem_cgroup_threshold_check(mem))
> > +		mem_cgroup_threshold(mem);
> > +
> >  }
> >  
> >  /**
> > 
> > 
> 

--
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>

  reply	other threads:[~2010-02-12  7:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12  6:44 [PATCH 0/2] memcg patches around event counting...softlimit and thresholds KAMEZAWA Hiroyuki
2010-02-12  6:47 ` [PATCH 1/2] memcg : update softlimit and threshold at commit KAMEZAWA Hiroyuki
2010-02-12  7:33   ` Daisuke Nishimura
2010-02-12  7:42     ` KAMEZAWA Hiroyuki [this message]
2010-02-12  6:48 ` [PATCH 2/2] memcg: share event counter rather than duplicate KAMEZAWA Hiroyuki
2010-02-12  7:40   ` Daisuke Nishimura
2010-02-12  7:41     ` KAMEZAWA Hiroyuki
2010-02-12  7:46   ` Kirill A. Shutemov
2010-02-12  7:46     ` KAMEZAWA Hiroyuki
2010-02-12  8:07   ` Kirill A. Shutemov
2010-02-12  8:19     ` KAMEZAWA Hiroyuki
2010-02-12  8:49       ` Kirill A. Shutemov
2010-02-12  8:51         ` KAMEZAWA Hiroyuki
2010-02-12  9:05 ` [PATCH 0/2] memcg patches around event counting...softlimit and thresholds v2 KAMEZAWA Hiroyuki
2010-02-12  9:06   ` [PATCH 1/2] memcg: update threshold and softlimit at commit v2 KAMEZAWA Hiroyuki
2010-02-12  9:09   ` [PATCH 2/2] memcg : share event counter rather than duplicate v2 KAMEZAWA Hiroyuki
2010-02-12 11:48     ` Daisuke Nishimura
2010-02-15  0:19       ` KAMEZAWA Hiroyuki
2010-03-09 23:15         ` Andrew Morton
2010-02-15 10:57     ` Kirill A. Shutemov
2010-02-16  0:16       ` KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100212164201.2ec8f0ff.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kirill@shutemov.name \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox