linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>
Subject: Re: [PATCH 4/6] memcg: new force_empty and move_account
Date: Thu, 2 Oct 2008 14:13:13 +0900	[thread overview]
Message-ID: <20081002141313.0882baba.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20081001093804.b392e418.randy.dunlap@oracle.com>

Thank yoy for review!

On Wed, 1 Oct 2008 09:38:04 -0700
Randy Dunlap <randy.dunlap@oracle.com> wrote:

> On Wed, 1 Oct 2008 16:59:12 +0900 KAMEZAWA Hiroyuki wrote:
> 
> >  Documentation/controllers/memory.txt |   10 -
> >  mm/memcontrol.c                      |  267 +++++++++++++++++++++++++++--------
> >  2 files changed, 216 insertions(+), 61 deletions(-)
> > 
> > Index: mmotm-2.6.27-rc7+/mm/memcontrol.c
> > ===================================================================
> > --- mmotm-2.6.27-rc7+.orig/mm/memcontrol.c
> > +++ mmotm-2.6.27-rc7+/mm/memcontrol.c
> > @@ -538,6 +533,24 @@ nomem:
> >  	return -ENOMEM;
> >  }
> >  
> > +/**
> > + * mem_cgroup_try_charge - get charge of PAGE_SIZE.
> > + * @mm: an mm_struct which is charged against. (when *memcg is NULL)
> > + * @gfp_mask: gfp_mask for reclaim.
> > + * @memcg: a pointer to memory cgroup which is charged against.
> > + *
> > + * charge aginst memory cgroup pointed by *memcg. if *memcg == NULL, estimated
> > + * memory cgroup from @mm is got and stored in *memcg.
> > + *
> > + * Retruns 0 if success. -ENOMEM at failure.
> > + */
> > +
> > +int mem_cgroup_try_charge(struct mm_struct *mm,
> > +			  gfp_t mask, struct mem_cgroup **memcg)
> > +{
> > +	return __mem_cgroup_try_charge(mm, mask, memcg, false);
> > +}
> > +
> >  /*
> >   * commit a charge got by mem_cgroup_try_charge() and makes page_cgroup to be
> >   * USED state. If already USED, uncharge and return.
> > @@ -567,11 +580,109 @@ static void __mem_cgroup_commit_charge(s
> >  	mz = page_cgroup_zoneinfo(pc);
> >  
> >  	spin_lock_irqsave(&mz->lru_lock, flags);
> > -	__mem_cgroup_add_list(mz, pc);
> > +	__mem_cgroup_add_list(mz, pc, true);
> >  	spin_unlock_irqrestore(&mz->lru_lock, flags);
> >  	unlock_page_cgroup(pc);
> >  }
> >  
> > +/**
> > + * mem_cgroup_move_account - move account of the page
> > + * @pc   ... page_cgroup of the page.
> > + * @from ... mem_cgroup which the page is moved from.
> > + * @to   ... mem_cgroup which the page is moved to. @from != @to.
> 
> Bad kernel-doc format.  Use (e.g.)
>  * @pc: page_cgroup of the page
> 
Hmm, sorry.

> as was done in the function above.
> 
> > + *
> > + * The caller must confirm following.
> > + * 1. disable irq.
> > + * 2. lru_lock of old mem_cgroup(@from) should be held.
> > + *
> > + * returns 0 at success,
> > + * returns -EBUSY when lock is busy or "pc" is unstable.
> > + *
> > + * This function do "uncharge" from old cgroup but doesn't do "charge" to
> 
>                     does
> 
will fix.

> > + * new cgroup. It should be done by a caller.
> > + */
> > +
> > +static int mem_cgroup_move_account(struct page_cgroup *pc,
> > +	struct mem_cgroup *from, struct mem_cgroup *to)
> > +{
> ...
> > +}
> > +
> > Index: mmotm-2.6.27-rc7+/Documentation/controllers/memory.txt
> > ===================================================================
> > --- mmotm-2.6.27-rc7+.orig/Documentation/controllers/memory.txt
> > +++ mmotm-2.6.27-rc7+/Documentation/controllers/memory.txt
> > @@ -211,7 +211,9 @@ The memory.force_empty gives an interfac
> >  
> >  # echo 1 > memory.force_empty
> >  
> > -will drop all charges in cgroup. Currently, this is maintained for test.
> > +Will move account to parent. if parenet is full, will try to free pages.
> 
>                                 If parent
> 
Ah, sorry.

> > +If both of a parent and a child are busy, return -EBUSY;
> 
> maybe:
>    If both parent and child are busy, return -EBUSY.
> 
will fix.


> > +This file, memory.force_empty, is just for debug purpose.
> >  
> >  4. Testing
> >  
> > @@ -242,8 +244,10 @@ reclaimed.
> >  
> >  A cgroup can be removed by rmdir, but as discussed in sections 4.1 and 4.2, a
> >  cgroup might have some charge associated with it, even though all
> > -tasks have migrated away from it. Such charges are automatically dropped at
> > -rmdir() if there are no tasks.
> > +tasks have migrated away from it.
> > +Such charges are moved to its parent as mush as possible and freed if parent
> 
>                                            much
> 
will fix

> > +seems to be full. (see force_empty)
> 
> seems??  Is it questionable/unsure?
> 

It's unstable state. If someone frees some page, it's not full.
But "seems" is not good, I'll remove "seems".

Thanks,
-Kame


--
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:[~2008-10-02  5:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-01  7:52 [PATCH 0/6] memcg update v6 (for review and discuss) KAMEZAWA Hiroyuki
2008-10-01  7:55 ` [PATCH 1/6] atomic page_cgroup flags KAMEZAWA Hiroyuki
2008-10-06  7:42   ` Balbir Singh
2008-10-01  7:56 ` [PATCH 2/6] memcg: allocate page_cgroup at boot KAMEZAWA Hiroyuki
2008-10-02  8:49   ` [PATCH 2/6] memcg: allocate page_cgroup at boot (hunk fix) KAMEZAWA Hiroyuki
2008-10-06 16:32     ` Balbir Singh
2008-10-06 10:11   ` [PATCH 2/6] memcg: allocate page_cgroup at boot Balbir Singh
2008-10-01  7:57 ` [PATCH 3/6] memcg: charge-commit-cancel protocl KAMEZAWA Hiroyuki
2008-10-01  8:33   ` Daisuke Nishimura
2008-10-01 10:04   ` kamezawa.hiroyu
2008-10-03 10:05   ` Daisuke Nishimura
2008-10-03 15:15   ` kamezawa.hiroyu
2008-10-03 15:25     ` Daisuke Nishimura
2008-10-08  9:05   ` [RFC] memcg: handle migration by charge-commit-cancel (was " KAMEZAWA Hiroyuki
2008-10-01  7:59 ` [PATCH 4/6] memcg: new force_empty and move_account KAMEZAWA Hiroyuki
2008-10-01 16:38   ` Randy Dunlap
2008-10-02  5:13     ` KAMEZAWA Hiroyuki [this message]
2008-10-01  8:00 ` [PATCH 5/6] memcg: lazy lru freeing KAMEZAWA Hiroyuki
2008-10-09  5:39   ` Daisuke Nishimura
2008-10-09  6:26     ` KAMEZAWA Hiroyuki
2008-10-01  8:01 ` [PATCH 6/6] memcg: lazy lru addition KAMEZAWA Hiroyuki
2008-10-09  6:21   ` Daisuke Nishimura
2008-10-09  6:51     ` KAMEZAWA Hiroyuki
2008-10-02  9:02 ` [PATCH 0/6] memcg update v6 (for review and discuss) KAMEZAWA Hiroyuki
2008-10-06 17:26   ` Balbir Singh
2008-10-07  1:22     ` 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=20081002141313.0882baba.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=randy.dunlap@oracle.com \
    /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