lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Feb 2010 08:58:36 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	nishimura@....nes.nec.co.jp
Cc:	Daisuke Nishimura <d-nishimura@....biglobe.ne.jp>,
	"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
	rientjes@...gle.com, "linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC][PATCH] memcg: page fault oom improvement v2

On Tue, 23 Feb 2010 20:00:52 +0900
Daisuke Nishimura <d-nishimura@....biglobe.ne.jp> wrote:

> On Tue, 23 Feb 2010 17:38:35 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> 
> > On Tue, 23 Feb 2010 16:07:14 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> > 
> > > On Tue, 23 Feb 2010 15:55:43 +0900
> > > Daisuke Nishimura <nishimura@....nes.nec.co.jp> wrote:
> > > 
> > > > On Tue, 23 Feb 2010 15:26:50 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> > > > > On Tue, 23 Feb 2010 15:21:16 +0900
> > > > > Daisuke Nishimura <nishimura@....nes.nec.co.jp> wrote:
> > > > > 
> > > > > > On Tue, 23 Feb 2010 14:02:18 +0900, Daisuke Nishimura <nishimura@....nes.nec.co.jp> wrote:
> > > > > > > On Tue, 23 Feb 2010 12:03:15 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@...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).)
> 
Ah, ok. I'll do.

Thanks,
-Kame

> 
> Thanks,
> Daisuke Nishimura.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ