Thread (21 messages) 21 messages, 6 authors, 2011-10-29

Re: [patch] oom: thaw threads if oom killed thread is frozen before deferring

From: Oleg Nesterov <oleg@redhat.com>
Date: 2011-09-29 16:41:38
Also in: lkml

On 09/29, Michal Hocko wrote:
On Thu 29-09-11 14:05:17, Oleg Nesterov wrote:
quoted
But of course this can't help if freeze_task() is called later.
May be freezable() should check TIF_MEMDIE...
Wouldn't it be easier to ignore try_to_freeze when fatal signals are
pending in get_signal_to_deliver?
Oh, I don't think so. For what? This doesn't close other races, and
in fact the fatal_signal_pending() this patch adds is itself racy,
SIGKILL can come in between.
quoted hunk ↗ jump to hunk
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -48,6 +48,11 @@ void refrigerator(void)
 	current->flags |= PF_FREEZING;

 	for (;;) {
+		if (fatal_signal_pending(current)) {
+			if (freezing(current) || frozen(current))
+				thaw_process(current);
Ah, I didn't mean refrigerator() should check freezing/frozen.

I meant, oom_kill can do this before thaw thaw_process(), afaics
this should fix the particular race you described (but not others).

And. It is simply wrong to return from refrigerator() after we set
PF_FROZEN, this can fool try_to_freeze_tasks(). Sure, thaw_process()
from oom_kill is not nice too, but at least this is the special case,
we already have the problem.

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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help