From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx142.postini.com [74.125.245.142]) by kanga.kvack.org (Postfix) with SMTP id B6FC06B0062 for ; Wed, 31 Oct 2012 22:05:46 -0400 (EDT) Date: Thu, 1 Nov 2012 11:11:45 +0900 From: Minchan Kim Subject: Re: zram OOM behavior Message-ID: <20121101021145.GF26256@bbox> References: <20121030001809.GL15767@bbox> <20121031005738.GM15767@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes Cc: Luigi Semenzato , linux-mm@kvack.org, Dan Magenheimer , KOSAKI Motohiro , Sonny Rao On Wed, Oct 31, 2012 at 11:54:07AM -0700, David Rientjes wrote: > On Wed, 31 Oct 2012, Minchan Kim wrote: > > > It sounds right in your kernel but principal problem is min_filelist_kbytes patch. > > If normal exited process in exit path requires a page and there is no free page > > any more, it ends up going to OOM path after try to reclaim memory several time. > > Then, > > In select_bad_process, > > > > if (task->flags & PF_EXITING) { > > if (task == current) <== true > > return OOM_SCAN_SELECT; > > In oom_kill_process, > > > > if (p->flags & PF_EXITING) > > set_tsk_thread_flag(p, TIF_MEMDIE); > > > > At last, normal exited process would get a free page. > > > > select_bad_process() won't actually select the process for oom kill, > though, if there are other PF_EXITING threads other than current. So if > multiple threads are page faulting on tsk->robust_list, then no thread > ends up getting killed. The temporary workaround would be to do a kill -9 If mutiple threads are page faulting and try to allocate memory, then they should go to oom path and they will reach following code. if (task->flags & PF_EXITING) { if (task == current) return OOM_SCAN_SELECT; So, the thread can access reseved memory pool and page fault will succeed. > so that the logic in out_of_memory() could immediately give such threads > access to memory reserves so the page fault will succeed. The real fix > would be to audit all possible cases in between setting > tsk->flags |= PF_EXITING and tsk->mm = NULL that could cause a memory > allocation and make exemptions for them in oom_scan_process_thread(). > > -- > 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: email@kvack.org -- Kind regards, Minchan Kim -- 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: email@kvack.org