linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	linux-mm@kvack.org, kosaki.motohiro@gmail.com
Subject: Re: [patch v3] mm, oom: do not schedule if current has been killed
Date: Tue, 19 Jun 2012 17:39:53 -0400	[thread overview]
Message-ID: <4FE0F1A9.7050607@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1206191358030.21795@chino.kir.corp.google.com>

(6/19/12 4:58 PM), David Rientjes wrote:
> The oom killer currently schedules away from current in an
> uninterruptible sleep if it does not have access to memory reserves.
> It's possible that current was killed because it shares memory with the
> oom killed thread or because it was killed by the user in the interim,
> however.
> 
> This patch only schedules away from current if it does not have a pending
> kill, i.e. if it does not share memory with the oom killed thread.  It's
> possible that it will immediately retry its memory allocation and fail,
> but it will immediately be given access to memory reserves if it calls
> the oom killer again.
> 
> This prevents the delay of memory freeing when threads that share memory
> with the oom killed thread get unnecessarily scheduled.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  mm/oom_kill.c |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -746,11 +746,11 @@ out:
>  	read_unlock(&tasklist_lock);
>  
>  	/*
> -	 * Give "p" a good chance of killing itself before we
> -	 * retry to allocate memory unless "p" is current
> +	 * Give the killed threads a good chance of exiting before trying to
> +	 * allocate memory again.
>  	 */
> -	if (killed && !test_thread_flag(TIF_MEMDIE))
> -		schedule_timeout_uninterruptible(1);
> +	if (killed)
> +		schedule_timeout_killable(1);
>  }

This is not match I expected. but I have no seen a big problem.

Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>


>  
>  /*
> @@ -765,6 +765,5 @@ void pagefault_out_of_memory(void)
>  		out_of_memory(NULL, 0, 0, NULL, false);
>  		clear_system_oom();
>  	}
> -	if (!test_thread_flag(TIF_MEMDIE))
> -		schedule_timeout_uninterruptible(1);
> +	schedule_timeout_killable(1);
>  }
> 
> --
> 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>

--
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:[~2012-06-19 21:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-19  1:08 [patch] mm, oom: do not schedule if current has been killed David Rientjes
2012-06-19  1:57 ` Kamezawa Hiroyuki
2012-06-19  2:23   ` David Rientjes
2012-06-19  2:31     ` [patch v2] " David Rientjes
2012-06-19  2:51       ` Kamezawa Hiroyuki
2012-06-19  6:03       ` KOSAKI Motohiro
2012-06-19  6:26         ` David Rientjes
2012-06-19 17:32           ` KOSAKI Motohiro
2012-06-19 18:59             ` David Rientjes
2012-06-19 19:29               ` KOSAKI Motohiro
2012-06-19 13:55       ` Oleg Nesterov
2012-06-19 20:24         ` David Rientjes
2012-06-19 20:58           ` [patch v3] " David Rientjes
2012-06-19 21:39             ` KOSAKI Motohiro [this message]
2012-06-20  0:38               ` Kamezawa Hiroyuki
2012-06-21  1:23                 ` David Rientjes

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=4FE0F1A9.7050607@gmail.com \
    --to=kosaki.motohiro@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=oleg@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).