From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757863Ab0DAQVK (ORCPT ); Thu, 1 Apr 2010 12:21:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11081 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757727Ab0DAQUt (ORCPT ); Thu, 1 Apr 2010 12:20:49 -0400 Date: Thu, 1 Apr 2010 16:39:10 +0200 From: Oleg Nesterov To: David Rientjes Cc: Andrew Morton , anfei , KOSAKI Motohiro , nishimura@mxp.nes.nec.co.jp, KAMEZAWA Hiroyuki , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [patch] oom: give current access to memory reserves if it has been killed Message-ID: <20100401143910.GB14603@redhat.com> References: <20100329112111.GA16971@redhat.com> <20100330154659.GA12416@redhat.com> <20100331175836.GA11635@redhat.com> <20100331224904.GA4025@redhat.com> <20100331233058.GA6081@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/31, David Rientjes wrote: > > On Thu, 1 Apr 2010, Oleg Nesterov wrote: > > > > Why? You ignored this part: > > > > > > Say, right after exit_mm() we are doing acct_process(), and f_op->write() > > > needs a page. So, you are saying that in this case __page_cache_alloc() > > > can never trigger out_of_memory() ? > > > > > > why this is not possible? > > > > > > David, I am not arguing, I am asking. > > > > In case I wasn't clear... > > > > Yes, currently __oom_kill_task(p) is not possible if p->mm == NULL. > > > > But your patch adds > > > > if (fatal_signal_pending(current)) > > __oom_kill_task(current); > > > > into out_of_memory(). > > > > Ok, and it's possible during the tasklist scan if current is PF_EXITING > and that gets passed to oom_kill_process(), Yes, but this is harmless, afaics. The task is either current or it was found by select_bad_process() under tasklist. This means it is safe to use force_sig (but as I said, we should not use force_sig() anyway). > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -459,7 +459,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, > * its children or threads, just set TIF_MEMDIE so it can die quickly > */ > if (p->flags & PF_EXITING) { > - __oom_kill_task(p); > + set_tsk_thread_flag(p, TIF_MEMDIE); So, probably this makes sense anyway but not strictly necessary, up to you. > if (fatal_signal_pending(current)) { > - __oom_kill_task(current); > + set_tsk_thread_flag(current, TIF_MEMDIE); Yes, I think this fix is needed. Oleg. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail143.messagelabs.com (mail143.messagelabs.com [216.82.254.35]) by kanga.kvack.org (Postfix) with SMTP id 26E826B01EE for ; Thu, 1 Apr 2010 10:40:58 -0400 (EDT) Date: Thu, 1 Apr 2010 16:39:10 +0200 From: Oleg Nesterov Subject: Re: [patch] oom: give current access to memory reserves if it has been killed Message-ID: <20100401143910.GB14603@redhat.com> References: <20100329112111.GA16971@redhat.com> <20100330154659.GA12416@redhat.com> <20100331175836.GA11635@redhat.com> <20100331224904.GA4025@redhat.com> <20100331233058.GA6081@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org To: David Rientjes Cc: Andrew Morton , anfei , KOSAKI Motohiro , nishimura@mxp.nes.nec.co.jp, KAMEZAWA Hiroyuki , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org List-ID: On 03/31, David Rientjes wrote: > > On Thu, 1 Apr 2010, Oleg Nesterov wrote: > > > > Why? You ignored this part: > > > > > > Say, right after exit_mm() we are doing acct_process(), and f_op->write() > > > needs a page. So, you are saying that in this case __page_cache_alloc() > > > can never trigger out_of_memory() ? > > > > > > why this is not possible? > > > > > > David, I am not arguing, I am asking. > > > > In case I wasn't clear... > > > > Yes, currently __oom_kill_task(p) is not possible if p->mm == NULL. > > > > But your patch adds > > > > if (fatal_signal_pending(current)) > > __oom_kill_task(current); > > > > into out_of_memory(). > > > > Ok, and it's possible during the tasklist scan if current is PF_EXITING > and that gets passed to oom_kill_process(), Yes, but this is harmless, afaics. The task is either current or it was found by select_bad_process() under tasklist. This means it is safe to use force_sig (but as I said, we should not use force_sig() anyway). > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -459,7 +459,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, > * its children or threads, just set TIF_MEMDIE so it can die quickly > */ > if (p->flags & PF_EXITING) { > - __oom_kill_task(p); > + set_tsk_thread_flag(p, TIF_MEMDIE); So, probably this makes sense anyway but not strictly necessary, up to you. > if (fatal_signal_pending(current)) { > - __oom_kill_task(current); > + set_tsk_thread_flag(current, TIF_MEMDIE); Yes, I think this fix is needed. Oleg. -- 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