This is an archive of the discontinued LLVM Phabricator instance.

tsan: increase max number of threads supported by test-only barrier
ClosedPublic

Authored by dvyukov on Jul 28 2021, 6:03 AM.

Details

Summary

Currently the barrier supports only 256 threads,
this does not allow to write reliable tests that use more threads.
Bump max number of threads to 1024 to support writing
good stress tests.
Also replace sched_yield() with usleep(100) on the wait path.
If we write tests that create hundreds of threads (and dozens
of tests can run in parallel), yield would consume massive
amounts of CPU time for spinning.

Depends on D106952.

Diff Detail

Event Timeline

dvyukov created this revision.Jul 28 2021, 6:03 AM
dvyukov requested review of this revision.Jul 28 2021, 6:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2021, 6:03 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
melver accepted this revision.Jul 28 2021, 7:56 AM
melver added inline comments.
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
2923

static constexpr ?

This revision is now accepted and ready to land.Jul 28 2021, 7:56 AM
dvyukov added inline comments.Jul 28 2021, 8:14 AM
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
2923

3.5/3
A name having namespace scope (3.3.6) has internal linkage if it is the name of
— a variable that is explicitly declared const or constexpr and neither explicitly declared extern nor
previously declared to have external linkage;

melver added inline comments.Jul 28 2021, 8:16 AM
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
2923

Ah, very good.