Re: [patch] threading fix, tid-2.5.47-A3

From: Ingo Molnar (mingo@elte.hu)
Date: Sun Nov 17 2002 - 15:18:12 EST


On Sun, 17 Nov 2002, Linus Torvalds wrote:

> In fact, SETTID is clearly useful even without threads, and exactly for
> the case that Ingo apparently broke with his patch: the parent wants to
> atomically save the TID of the child in the _parents_ address space (so
> that a immediate SIGCHLD won't be racy with saving off the pid by the
> parent).

while it makes sense, the problem in this case is that the 'TID address'
is the parent's TID address. (ie. might be futex-waited upon by some other
context, for an exit() event.)

i think what makes most sense is what Luca suggested, to split up the
things and use two different TID address: one for race-less setting of the
TID in the parent's address space, and another for the race-less
initialization of the TID value in the child's context.

> There's no reason to make SETTID/CLEARTID be one flag, since they are
> clearly different things, and NPTL can just always set both bits if that
> is the behaviour glibc wants (and I agree with that behaviour, of
> course. I just disagree with not allowing others to do different
> things).

ok, agreed. Other libraries might choose to still do SIGCHLD based exit()
notification - exit notification and initial-TID setting are separate
things.

(i'll send a new patch in a few minutes so that we can see the full impact
on things.)

        Ingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:19 EST