Re: freezer problems
From: Rafael J. Wysocki
Date: Wed Feb 21 2007 - 15:53:32 EST
On Wednesday, 21 February 2007 21:03, Oleg Nesterov wrote:
> On 02/21, Rafael J. Wysocki wrote:
> > On Wednesday, 21 February 2007 19:14, Paul E. McKenney wrote:
> > > On Tue, Feb 20, 2007 at 07:29:01PM +0100, Rafael J. Wysocki wrote:
> > > > On Tuesday, 20 February 2007 01:32, Rafael J. Wysocki wrote:
> > > > > On Tuesday, 20 February 2007 01:12, Oleg Nesterov wrote:
> > > > > Hm. In the case discussed above we have a task that's right before calling
> > > > > frozen_process(), so we can't thaw it, because it's not frozen. It will be
> > > > > frozen just in a while, but try_to_freeze_tasks() and thaw_tasks() have no
> > > > > way to check this.
> > > > >
> > > > > I think to close this race the refrigerator should check TIF_FREEZE and set
> > > > > PF_FROZEN _and_ reset TIF_FREEZE under a lock
> I personally think this is good. Not only this allows us to close the race,
> I think we can do more.
> > that would also have to be
> > > > > taken by try_to_freeze_tasks() in the beginning of the error path. This will
> > > > > ensure that all tasks either freeze themselves before the error path in
> > > > > try_to_freeze_tasks() is executed, or remain unfrozen.
> How about take this lock in thaw_tasks() instead/too ?
Good point. If we take it in thaw_tasks(), then the tasks that have
TIF_FREEZE set, but haven't entered the refrigerator yet, won't be able to
enter the refrigerator until thaw_tasks() releases the lock ...
> Currently we need a separate loop in thaw_tasks() to handle PF_FREEZER_SKIP. This
> means that PF_FREEZER_SKIP is not so generic: thaw_tasks() can't tolerate if such
> a task was woken in between. What if we change thaw_process() to clear TIF_FREEZE ?
... and then we can drop the PF_FREEZER_SKIP-handling loop and change
thaw_process() to clear TIF_FREEZE.
> Note also that we can use task_lock() instead of global refrigerator_lock. This
> means that thaw_process() should take it too, probably this is slowdown, but I
> think not too much because thaw_process() is going to write to p->flags anyway.
> In this case thaw_process() works perfectly as cancel_freezing_and_thaw() and
> can be used to fix exec/coredump in future.
Hm, I think we can try doing this too.
I'll try to prepare a patch later today.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/