This is an archive of the discontinued LLVM Phabricator instance.

tsan: optimize test-only barrier
ClosedPublic

Authored by dvyukov on Jul 29 2021, 11:50 PM.

Details

Summary

The updated lots_of_threads.c test with 300 threads
started running for too long on machines with low
hardware parallelism (e.g. taskset -c 0-1).
On lots of CPUs it finishes in ~2 secs. But with
taskset -c 0-1 it runs for hundreds of seconds
effectively spinning in the barrier in the sleep loop.

We now have the handy futex API in sanitizer_common.
Use it instead of the passive spin loop.
It makes the test run only faster with taskset -c 0-1,
it runs for ~1.5 secs, while with full parallelism
it still runs for ~2 secs (but consumes less CPU time).

Depends on D107131.

Diff Detail

Event Timeline

dvyukov created this revision.Jul 29 2021, 11:50 PM
dvyukov requested review of this revision.Jul 29 2021, 11:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2021, 11:50 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Jul 30 2021, 12:30 AM
This revision is now accepted and ready to land.Jul 30 2021, 12:30 AM
This revision was automatically updated to reflect the committed changes.