Re: 3.10.16 cgroup css_set_lock deadlock

From: Tejun Heo
Date: Sat Nov 16 2013 - 00:19:32 EST


Hello,

On Fri, Nov 15, 2013 at 09:53:14AM -0500, Don Morris wrote:
> Are we getting some other thread from while_each_task()
> repeatedly keeping us in the loop? Or is there something
> else going on? The gut instinct is that calling something
> like while_each_task() on an exiting thread would either
> reliably give other threads in the group or quit [if the
> thread is the only one left in the group or if an exiting
> thread is no longer part of the group], but since that would
> make the continue work, obviously I'm missing something.

Thread group leaders are stable at that point because threadgroup_lock
is held and are guaranteed to show up in while_each_thread traversal;
however, !leaders may already be in the process of exiting by the time
control reaches that point and may not show up in the iteration. As
RCU lock is held, it'll be *safe* to initiate or continue iteration
from it but when the iteration comes around, there's no guarantee that
it'll be included in it and the term condition depends on it showing
up again. That's what I remember anyway. Li, please correct me if
I'm mistaken.

Thanks.

--
tejun
--
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/