linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daisuke Nishimura <d-nishimura@mtf.biglobe.ne.jp>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	rientjes@google.com, "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Subject: Re: [RFC][PATCH] memcg: page fault oom improvement v2
Date: Tue, 23 Feb 2010 20:00:52 +0900	[thread overview]
Message-ID: <20100223200052.29a3375d.d-nishimura@mtf.biglobe.ne.jp> (raw)
In-Reply-To: <20100223173835.f260c111.kamezawa.hiroyu@jp.fujitsu.com>

On Tue, 23 Feb 2010 17:38:35 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> On Tue, 23 Feb 2010 16:07:14 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> 
> > On Tue, 23 Feb 2010 15:55:43 +0900
> > Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
> > 
> > > On Tue, 23 Feb 2010 15:26:50 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > > > On Tue, 23 Feb 2010 15:21:16 +0900
> > > > Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
> > > > 
> > > > > On Tue, 23 Feb 2010 14:02:18 +0900, Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
> > > > > > On Tue, 23 Feb 2010 12:03:15 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > > > > > > Nishimura-san, could you review and test your extreme test case with this ?
> > > > > > > 
> > > > > > Thank you for your patch.
> > > > > > I don't know why, but the problem seems not so easy to cause in mmotm as in 2.6.32.8,
> > > > > > but I'll try more anyway.
> > > > > > 
> > > > > I can triggered the problem in mmotm.
> > > > > 
> > > > > I'll continue my test with your patch applied.
> > > > > 
> > > > 
> > > > Thank you. Updated one here.
> > > > 
> > > Unfortunately, we need one more fix to avoid build error: remove the declaration
> > > of mem_cgroup_oom_called() from memcontrol.h.
> > > 
> > Ouch, I missed to add memcontrol.h to quilt's reflesh set..
> > This is updated one. Anyway, I'd like to wait for the next mmotm.
> > We already have several changes. 
> > 
> 
> After reviewing again, we may be able to remove memcg->oom_jiffies.
> Because select_bad_process() returns -1 if there is a TIF_MEMDIE task,
> no oom-kill will happen if a tasks is being killed.
> 
> But a concern is simultaneous calls of out-of-memory. I think mutex will
> be necessary. I'll check tomorrow, again.
> 
I see.

I have one more point.

> > @@ -1549,11 +1540,25 @@ static int __mem_cgroup_try_charge(struc
> >  		}
> >  
> >  		if (!nr_retries--) {
> > -			if (oom) {
> > -				mem_cgroup_out_of_memory(mem_over_limit, gfp_mask);
> > +			int oom_kill_called;
> > +			if (!oom)
> > +				goto nomem;
> > +			mutex_lock(&memcg_oom_mutex);
> > +			oom_kill_called = mem_cgroup_oom_called(mem_over_limit);
> > +			if (!oom_kill_called)
> >  				record_last_oom(mem_over_limit);
> > -			}
> > -			goto nomem;
> > +			mutex_unlock(&memcg_oom_mutex);
> > +			if (!oom_kill_called)
> > +				mem_cgroup_out_of_memory(mem_over_limit,
> > +				gfp_mask);
> > +			else /* give a chance to die for other tasks */
> > +				schedule_timeout(1);
> > +			nr_retries = MEM_CGROUP_RECLAIM_RETRIES;
> > +			/* Killed myself ? */
> > +			if (!test_thread_flag(TIF_MEMDIE))
> > +				continue;
> > +			/* For smooth oom-kill of current, return 0 */
> > +			return 0;
We must call css_put() and reset *memcg to NULL before returning 0.
Otherwise, following commit_charge will commits the page(i.e. set PCG_USED)
while we've not charged res_counter.
(In fact, I saw res_counter underflow warnings(res_counter.c:72).)


Thanks,
Daisuke Nishimura.

--
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-23 10:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23  3:03 [RFC][PATCH] memcg: page fault oom improvement KAMEZAWA Hiroyuki
2010-02-23  5:02 ` Daisuke Nishimura
2010-02-23  6:21   ` Daisuke Nishimura
2010-02-23  6:26     ` [RFC][PATCH] memcg: page fault oom improvement v2 KAMEZAWA Hiroyuki
2010-02-23  6:55       ` Daisuke Nishimura
2010-02-23  7:07         ` KAMEZAWA Hiroyuki
2010-02-23  8:38           ` KAMEZAWA Hiroyuki
2010-02-23 11:00             ` Daisuke Nishimura [this message]
2010-02-23 23:58               ` KAMEZAWA Hiroyuki
2010-02-23 22:49           ` David Rientjes
2010-02-24  0:08             ` KAMEZAWA Hiroyuki
2010-02-24  1:42               ` David Rientjes
2010-02-24  1:48                 ` KAMEZAWA Hiroyuki
2010-02-24  2:26                   ` David Rientjes
2010-02-24  2:25                     ` KAMEZAWA Hiroyuki
2010-02-23  6:10 ` [RFC][PATCH] memcg: page fault oom improvement Balbir Singh
2010-02-23  6:12   ` 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=20100223200052.29a3375d.d-nishimura@mtf.biglobe.ne.jp \
    --to=d-nishimura@mtf.biglobe.ne.jp \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=rientjes@google.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