This is an archive of the discontinued LLVM Phabricator instance.

tsan: move mem profile initialization into separate function
ClosedPublic

Authored by dvyukov on Sep 21 2021, 4:15 AM.

Details

Summary

BackgroundThread function is quite large,
move mem profile initialization into a separate function.

Depends on D110151.

Diff Detail

Event Timeline

dvyukov requested review of this revision.Sep 21 2021, 4:15 AM
dvyukov created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2021, 4:15 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka added inline comments.Sep 21 2021, 1:54 PM
compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
180

maybe call MaybeSpawnBackgroundThread(); not here but after call to InitializeMemoryProfiler
it looks like a general thread which is used by profiler only so far, but can be extended

vitalybuka accepted this revision.Sep 21 2021, 1:54 PM
This revision is now accepted and ready to land.Sep 21 2021, 1:54 PM
melver accepted this revision.Sep 22 2021, 12:40 AM
dvyukov added inline comments.Sep 22 2021, 12:50 AM
compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
180

Currently MaybeSpawnBackgroundThread is conditional because of the early returns in this function (profiler is not enabled). And I think we tried to not spawn the background thread until necessary (either we have the profiler enabled, or the app itself is multithreaded) because of some SECCOMP sandboxing issues (if we make otherwise single-threaded process multi-threaded some things may fail).

dvyukov updated this revision to Diff 374140.Sep 22 2021, 1:10 AM

rebased and addressed comments

This revision was landed with ongoing or failed builds.Sep 22 2021, 1:18 AM
This revision was automatically updated to reflect the committed changes.