Hello, On Tue, Sep 09, 2014 at 06:06:25PM +0200, Michal Hocko wrote: > > Even for userland tasks, try_to_freeze() can currently be anywhere in > > the kernel. The frequently used ones are few but there are some odd > > I always thought that user space tasks can be in the fridge only on the > way out from the kernel (get_signal_to_deliver). I have quickly greped
It *can* be anywhere. We used to have some deep in nfs. They got removed later due to deadlocks but in theory they still can be anywhere. > the code and the only place I can see seems to be run_guest but that > one bails out quickly when there are signals pending so it should be > safe in this context. > cifs is doing something suspicious (cifs_reconnect) but I didn't check > more closely all the contexts it is called from. Prolly something similar with what nfs was doing? > > ones out, and, again, there's nothing enforcing any structure on > > try_to_freeze() usage. > > Would it make sense to have try_to_freeze_user_task or similar and check > for kernel thread in try_to_freeze and complain loudly if called from > user task context? I mean does it even make sense to call try_to_freeze > in the middle of kernel operation for a user task? I personally think the whole try_to_freeze() was a mistake at least for userland tasks. We should have collected them in a (mostly) single place like a jobctl stop. I'm not sure whether distinguishing the two interfaces would buy us much tho. > > The other thing is that we may do quite a bit during exiting including > > allocating memory. > > yes, we can allocate memory and even page fault on the exit path. But > TIF_MEMDIE will make sure that the allocation will be successful if > there is some memory left. TIF_MEMDIE ensures forward progress so that the task can exit; however, I'm not sure whether all the things that a task does during exit are safe for PM freezes. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/