On 12/04, Frederic Weisbecker wrote: > > On Wed, Dec 04, 2013 at 02:04:09PM +0100, Oleg Nesterov wrote: > > > For example, do/while_each_thread() always > > sees at least one task, while for_each_thread() can do nothing if > > the whole thread group has died. > > Would it be safe to have for_each_thread_continue() instead?
Yes, and no. Yes, perhaps we will need for_each_thread_continue(). I am not sure yet. And note that, say, check_hung_uninterruptible_tasks() already does _continue if fact, although it is still not clear to me if we actually need this helper. But no, _continue() can't help if the whole thread group has died, we simply can not continue. Note also that _continue() can't be safely used lockless, unless you verify pid_alive() or something similar. And, > Yeah if the conversion needs careful audit, it makes sense to switch > incrementally. Yes. For example the case above. If someone does do do_something(t); while_each_thread(g, t); we should check that it can tolerate the case when do_something() won't be called at all, or ensure that this is not possible. Oleg. -- 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/