On 07/09/2021 10:33, Sergey Bugaev via Libc-alpha wrote:
> Hello,
>
> this is yet another revision of the same patchset to stop issuing many
> redundant gsync_wake () calls. Following the brief feedback I got the last
> time, it switches most users of THREAD_GSCOPE_IN_TCB to PTHREAD_IN_LIBC, then
> actually introduces the new GSCOPE implementation, and then finally drops the
> remaining uses of THREAD_GSCOPE_IN_TCB entirely, since it's not always on.
>
> Things still seem to build and work somewhat (tested on GNU/Hurd i686 and
> GNU/Linux x86_64). rpctrace uname still shows that there are no more
> gsync_wake () calls.
>
> Apparently dlopen (RTLD_GLOBAL) is a good way to trigger THREAD_GSCOPE_WAIT
> ().
> I have written a test program that spawns 100 threads, then each of the
> threads
> dlopen's 100 shared objects, then dlclose's them back. On GNU/Linux, I have
> verified with GDB that it hits NPTL's __thread_gscope_wait (). I haven't been
> able to verify the same on the Hurd due to the general flakiness of GDB there,
> but I have ran the program with the patched glibc multiple times and it
> doesn't
> crash, so I assume it's working fine.
I can't voucher for Hurd changes, but the generic ones that might affect
Linux seems ok (the THREAD_GSCOPE_IN_TCB define is a nice cleanup).