glibc/nptl
Malte Skarupke 39a80f4035 nptl: Use all of g1_start and g_signals
[BZ #25847]

The LSB of g_signals was unused. The LSB of g1_start was used to indicate
which group is G2. This was used to always go to sleep in pthread_cond_wait
if a waiter is in G2. A comment earlier in the file says that this is not
correct to do:

 "Waiters cannot determine whether they are currently in G2 or G1 -- but they
  do not have to because all they are interested in is whether there are
  available signals"

I either would have had to update the comment, or get rid of the check. I
chose to get rid of the check. In fact I don't quite know why it was there.
There will never be available signals for group G2, so we didn't need the
special case. Even if there were, this would just be a spurious wake. This
might have caught some cases where the count has wrapped around, but it
wouldn't reliably do that, (and even if it did, why would you want to force a
sleep in that case?) and we don't support that many concurrent waiters
anyway. Getting rid of it allows us to use one more bit, making us more
robust to wraparound.

(cherry picked from commit 91bb902f58)

Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-07-11 13:56:09 -04:00
..
DESIGN-systemtap-probes.txt
Makefile
TODO
TODO-kernel
TODO-testing
Versions
alloca_cutoff.c
allocatestack.c
cancellation.c
cleanup.c
cleanup_compat.c
cleanup_defer.c
cleanup_defer_compat.c
cleanup_routine.c
default-sched.h
descr.h
elision-conf.c
elision-conf.h
elision-lock.c
elision-timed.c
elision-trylock.c
elision-unlock.c
errno-loc.c
events.c
futex-internal.c
libc-cleanup.c
libpthread-compat.c
lowlevellock.c
nptl-printers.py
nptl-stack.c
nptl-stack.h
nptl_deallocate_tsd.c
nptl_free_tcb.c
nptl_lock_constants.pysym
nptl_nthreads.c
nptl_setxid.c
nptlfreeres.c
old_pthread_cond_broadcast.c
old_pthread_cond_destroy.c
old_pthread_cond_init.c
old_pthread_cond_signal.c
old_pthread_cond_timedwait.c
old_pthread_cond_wait.c
perf.c
pthread_attr_copy.c
pthread_attr_destroy.c
pthread_attr_extension.c
pthread_attr_getaffinity.c
pthread_attr_getdetachstate.c
pthread_attr_getguardsize.c
pthread_attr_getinheritsched.c
pthread_attr_getschedparam.c
pthread_attr_getschedpolicy.c
pthread_attr_getscope.c
pthread_attr_getsigmask.c
pthread_attr_getstack.c
pthread_attr_getstackaddr.c
pthread_attr_getstacksize.c
pthread_attr_init.c
pthread_attr_setaffinity.c
pthread_attr_setdetachstate.c
pthread_attr_setguardsize.c
pthread_attr_setinheritsched.c
pthread_attr_setschedparam.c
pthread_attr_setschedpolicy.c
pthread_attr_setscope.c
pthread_attr_setsigmask.c
pthread_attr_setsigmask_internal.c
pthread_attr_setstack.c
pthread_attr_setstackaddr.c
pthread_attr_setstacksize.c
pthread_barrier_destroy.c
pthread_barrier_init.c
pthread_barrier_wait.c
pthread_barrierattr_destroy.c
pthread_barrierattr_getpshared.c
pthread_barrierattr_init.c
pthread_barrierattr_setpshared.c
pthread_cancel.c
pthread_cleanup_upto.c
pthread_clockjoin.c
pthread_cond_broadcast.c
pthread_cond_common.c
pthread_cond_destroy.c
pthread_cond_init.c
pthread_cond_signal.c
pthread_cond_wait.c
pthread_condattr_destroy.c
pthread_condattr_getclock.c
pthread_condattr_getpshared.c
pthread_condattr_init.c
pthread_condattr_setclock.c
pthread_condattr_setpshared.c
pthread_create.c
pthread_detach.c
pthread_equal.c
pthread_exit.c
pthread_getaffinity.c
pthread_getattr_default_np.c
pthread_getattr_np.c
pthread_getconcurrency.c
pthread_getcpuclockid.c
pthread_getname.c
pthread_getschedparam.c
pthread_getspecific.c
pthread_join.c
pthread_join_common.c
pthread_key_create.c
pthread_key_delete.c
pthread_keys.c
pthread_kill.c
pthread_kill_other_threads.c
pthread_mutex_cond_lock.c
pthread_mutex_conf.c
pthread_mutex_consistent.c
pthread_mutex_destroy.c
pthread_mutex_getprioceiling.c
pthread_mutex_init.c
pthread_mutex_lock.c
pthread_mutex_setprioceiling.c
pthread_mutex_timedlock.c
pthread_mutex_trylock.c
pthread_mutex_unlock.c
pthread_mutexattr_destroy.c
pthread_mutexattr_getprioceiling.c
pthread_mutexattr_getprotocol.c
pthread_mutexattr_getpshared.c
pthread_mutexattr_getrobust.c
pthread_mutexattr_gettype.c
pthread_mutexattr_init.c
pthread_mutexattr_setprioceiling.c
pthread_mutexattr_setprotocol.c
pthread_mutexattr_setpshared.c
pthread_mutexattr_setrobust.c
pthread_mutexattr_settype.c
pthread_once.c
pthread_rwlock_clockrdlock.c
pthread_rwlock_clockwrlock.c
pthread_rwlock_common.c
pthread_rwlock_destroy.c
pthread_rwlock_init.c
pthread_rwlock_rdlock.c
pthread_rwlock_timedrdlock.c
pthread_rwlock_timedwrlock.c
pthread_rwlock_tryrdlock.c
pthread_rwlock_trywrlock.c
pthread_rwlock_unlock.c
pthread_rwlock_wrlock.c
pthread_rwlockattr_destroy.c
pthread_rwlockattr_getkind_np.c
pthread_rwlockattr_getpshared.c
pthread_rwlockattr_init.c
pthread_rwlockattr_setkind_np.c
pthread_rwlockattr_setpshared.c
pthread_self.c
pthread_setaffinity.c
pthread_setattr_default_np.c
pthread_setcancelstate.c
pthread_setcanceltype.c
pthread_setconcurrency.c
pthread_setname.c
pthread_setschedparam.c
pthread_setschedprio.c
pthread_setspecific.c
pthread_sigmask.c
pthread_sigqueue.c
pthread_spin_destroy.c
pthread_spin_init.c
pthread_spin_lock.c
pthread_spin_trylock.c
pthread_spin_unlock.c
pthread_testcancel.c
pthread_timedjoin.c
pthread_tryjoin.c
pthread_yield.c
sem_clockwait.c
sem_destroy.c
sem_getvalue.c
sem_init.c
sem_post.c
sem_timedwait.c
sem_wait.c
sem_waitcommon.c
semaphoreP.h
shlib-versions
test-cond-printers.c
test-cond-printers.py
test-condattr-printers.c
test-condattr-printers.py
test-mutex-printers.c
test-mutex-printers.py
test-mutexattr-printers.c
test-mutexattr-printers.py
test-rwlock-printers.c
test-rwlock-printers.py
test-rwlockattr-printers.c
test-rwlockattr-printers.py
thrd_current.c
thrd_yield.c
tpp.c
tst-attr2.c
tst-attr3.c
tst-audit-threads-mod1.c
tst-audit-threads-mod2.c
tst-audit-threads.c
tst-audit-threads.h
tst-barrier5.c
tst-cancel4_1.c
tst-cancel4_2-time64.c
tst-cancel4_2.c
tst-cancel7.c
tst-cancel17.c
tst-cancel24-static.cc
tst-cancel24.cc
tst-cancelx7.c
tst-cancelx17.c
tst-cleanup4.c
tst-cleanup4aux.c
tst-cleanupx4.c
tst-cleanupx4aux.c
tst-clock2.c
tst-compat-forwarder-mod.c
tst-compat-forwarder.c
tst-cond22.c
tst-cond26.c
tst-context1.c
tst-default-attr.c
tst-dlsym1.c
tst-eintr1.c
tst-exec4.c
tst-exec5.c
tst-execstack-mod.c
tst-execstack.c
tst-initializers1-c11.c
tst-initializers1-c89.c
tst-initializers1-c99.c
tst-initializers1-gnu11.c
tst-initializers1-gnu89.c
tst-initializers1-gnu99.c
tst-initializers1.c
tst-minstack-cancel.c
tst-minstack-exit.c
tst-minstack-throw.cc
tst-mutex5a.c
tst-mutex7a.c
tst-mutex8-static.c
tst-mutex8.c
tst-mutexpi1.c
tst-mutexpi2.c
tst-mutexpi3.c
tst-mutexpi4.c
tst-mutexpi5.c
tst-mutexpi6.c
tst-mutexpi7.c
tst-mutexpi8-static.c
tst-mutexpi8.c
tst-mutexpi9.c
tst-mutexpi10.c
tst-mutexpi11.c
tst-mutexpi12.c
tst-mutexpp1.c
tst-mutexpp5.c
tst-mutexpp6.c
tst-mutexpp9.c
tst-mutexpp10.c
tst-oddstacklimit.c
tst-once5.cc
tst-pthread-attr-affinity-fail.c
tst-pthread-attr-affinity.c
tst-pthread-attr-sigmask.c
tst-pthread-defaultattr-free.c
tst-pthread-gdb-attach-static.c
tst-pthread-gdb-attach.c
tst-pthread-getattr.c
tst-pthread-timedlock-lockloop.c
tst-pthread_exit-nothreads-static.c
tst-pthread_exit-nothreads.c
tst-robust-fork.c
tst-robustpi1.c
tst-robustpi2.c
tst-robustpi3.c
tst-robustpi4.c
tst-robustpi5.c
tst-robustpi6.c
tst-robustpi7.c
tst-robustpi8.c
tst-robustpi9.c
tst-rwlock-pwn.c
tst-rwlock2.c
tst-rwlock3.c
tst-rwlock6.c
tst-rwlock7.c
tst-rwlock8.c
tst-rwlock9.c
tst-rwlock10.c
tst-rwlock11.c
tst-rwlock15.c
tst-rwlock17.c
tst-rwlock18.c
tst-rwlock19.c
tst-rwlock20.c
tst-rwlock21.c
tst-rwlock22.c
tst-sched1.c
tst-sem11-static.c
tst-sem11.c
tst-sem12-static.c
tst-sem12.c
tst-sem13.c
tst-sem17.c
tst-setgetname.c
tst-setgroups.c
tst-setuid1-static.c
tst-setuid1.c
tst-setuid2.c
tst-signal3.c
tst-signal7.c
tst-stack2.c
tst-stack3.c
tst-stack4.c
tst-stack4mod.c
tst-stackguard1-static.c
tst-stackguard1.c
tst-thread-affinity-pthread.c
tst-thread-affinity-pthread2.c
tst-thread-affinity-sched.c
tst-thread-exit-clobber.cc
tst-thread-setspecific.c
tst-thread_local1.cc
tst-tls3-malloc.c
tst-tls3.c
tst-tls3mod.c
tst-tls5.c
tst-tls5.h
tst-tls5mod.c
tst-tls5moda.c
tst-tls5modb.c
tst-tls5modc.c
tst-tls5modd.c
tst-tls5mode.c
tst-tls5modf.c
tst-tls6.sh
tst-tpp.h
tst-tsd3.c
tst-tsd4.c
unwind.c
unwindbuf.sym
vars.c