Re: [RFC][PATCH] memcg: page fault oom improvement v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> On Tue, 23 Feb 2010 16:07:14 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> 
> > On Tue, 23 Feb 2010 15:55:43 +0900
> > Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> wrote:
> > 
> > > On Tue, 23 Feb 2010 15:26:50 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> > > > On Tue, 23 Feb 2010 15:21:16 +0900
> > > > Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> wrote:
> > > > 
> > > > > On Tue, 23 Feb 2010 14:02:18 +0900, Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> wrote:
> > > > > > On Tue, 23 Feb 2010 12:03:15 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> 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@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]