lkml.org 
[lkml]   [2010]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: while_each_thread() under rcu_read_lock() is broken?
    On Thu, Jun 24, 2010 at 05:08:10PM -0700, Eric W. Biederman wrote:
    > Oleg Nesterov <oleg@redhat.com> writes:
    >
    > > On 06/24, Chris Friesen wrote:
    > >>
    > >> On 06/24/2010 12:07 PM, Paul E. McKenney wrote:
    > >>
    > >> > 3. The thread-group leader might do pthread_exit(), removing itself
    > >> > from the thread group -- and might do so while the hapless reader
    > >> > is referencing that thread.
    > >> >
    > >> > But isn't this prohibited? Or is it really legal to do a
    > >> > pthread_create() to create a new thread and then have the
    > >> > parent thread call pthread_exit()? Not something I would
    > >> > consider trying in my own code! Well, I might, just to
    > >> > be perverse, but... ;-)
    > >>
    > >> I believe SUS allows the main thread to explicitly call pthread_exit(),
    > >> leaving the other threads to run. If the main() routine just returns
    > >> then it implicitly calls exit().
    > >
    > > Correct.
    > >
    > > But, to clarify, if the main thread does pthread_exit() (sys_exit,
    > > actually), it won't be removed from the group. It will be zombie
    > > until all other threads exit.
    >
    > That we don't cleanup that zombie leaders is unfortunate really, it
    > means we have the entire de_thread special case. But short fixing
    > libpthread to not make bad assumptions there is little we can do about
    > it really.

    Keeping the zombie leaders does make at least one of the lockless
    scan cases quite a bit simpler. I think, anyway.

    > I'm only half following this conversation.
    >
    > If what we are looking for is a stable list_head that won't disappear
    > on us we should be able to put one in sighand_struct or signal_struct
    > (I forget which is which at the moment) and have a list_head that
    > lives for the life of the longest living thread, and that won't get
    > messed up by things like de_thread, and then next_thread could simply
    > return NULL when we hit the end of the list.

    Oleg did suggest this possibility, but there were complications that
    I do not claim to fully understand.

    Thanx, Paul


    \
     
     \ /
      Last update: 2010-06-25 05:45    [W:0.026 / U:59.856 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site