All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] mm, oom: do not schedule if current has been killed
@ 2012-06-19  1:08 David Rientjes
  2012-06-19  1:57 ` Kamezawa Hiroyuki
  0 siblings, 1 reply; 16+ messages in thread
From: David Rientjes @ 2012-06-19  1:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: KAMEZAWA Hiroyuki, KOSAKI Motohiro, Oleg Nesterov, linux-mm

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 |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -749,7 +749,7 @@ out:
 	 * Give "p" a good chance of killing itself before we
 	 * retry to allocate memory unless "p" is current
 	 */
-	if (killed && !test_thread_flag(TIF_MEMDIE))
+	if (killed && !fatal_signal_pending(current))
 		schedule_timeout_uninterruptible(1);
 }
 
@@ -765,6 +765,6 @@ void pagefault_out_of_memory(void)
 		out_of_memory(NULL, 0, 0, NULL, false);
 		clear_system_oom();
 	}
-	if (!test_thread_flag(TIF_MEMDIE))
+	if (!fatal_signal_pending(current))
 		schedule_timeout_uninterruptible(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>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-06-21  1:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-06-20  0:38               ` Kamezawa Hiroyuki
2012-06-21  1:23                 ` David Rientjes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.