diff options
author | Tim Murray <timmurray@google.com> | 2020-10-07 17:11:28 +0000 |
---|---|---|
committer | Tim Murray <timmurray@google.com> | 2020-10-15 16:16:07 +0000 |
commit | 9c08f4fecc5a8179426c4436071e6a451396eb38 (patch) | |
tree | d7c9587b18b018d91c0da6b0d24100e005f0bac4 /libc/malloc_hooks/malloc_hooks.cpp | |
parent | dcbc8ec29a148b0a3fdf675d91b77141325a3a36 (diff) |
pthread_cond: only call futex_wake when there are waiters
pthread_cond_pulse would unconditionally call futex, which meant that
a number of processes were spending a significant amount of time in
pthread_cond_broadcast and pthread_cond_signal when there were no
threads waiting on that pthread_cond_t.
This change adds a counter to the 64-bit pthread_cond_t struct and
only calls futex() in cases where there is a nonzero waiter count. The
32-bit pthread_cond_t is unchanged due to compatibility reasons.
Test: no pthread_cond_broadcast/signal stacks without try_to_wake_up
in SurfaceFlinger
bug: 168831708
Change-Id: I105e1345cd2a3a75f98cd0acf316e790ba1716f0
Diffstat (limited to 'libc/malloc_hooks/malloc_hooks.cpp')
0 files changed, 0 insertions, 0 deletions