This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Atomic access to StackDepot stats
AbandonedPublic

Authored by vitalybuka on Sep 28 2021, 9:55 AM.

Details

Reviewers
morehouse
eugenis

Diff Detail

Event Timeline

vitalybuka requested review of this revision.Sep 28 2021, 9:55 AM
vitalybuka created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2021, 9:55 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
eugenis added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
129

Missing ;

135

This is a more expensive operation than the one used before. Probably does not matter, but please check that you are not slowing things down.

eugenis added inline comments.Sep 28 2021, 4:23 PM
compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
135

Did you look at perf with msan? Stackdepot is much busier with msan. This is an atomic r/m/w of a global location...

eugenis added inline comments.Sep 28 2021, 4:32 PM
compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
135

In fact. Why can't we add up seq[i] numbers for each part when we read the stats, instead of maintaining an extra global counter?

vitalybuka added inline comments.Sep 29 2021, 12:08 PM
compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
135

no, but I run large test on Asan where Put() costs solid 6% and see no difference.
Note that this is a slow path. Only fraction of Most ::Put calls endup here, and we already acquired a lock.
We need try hard to slowdown this code if we change anything after line 116.

vitalybuka added inline comments.Sep 29 2021, 12:21 PM
compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
135

In fact. Why can't we add up seq[i] numbers for each part when we read the stats, instead of maintaining an extra global counter?

We can, but this is unrelated change.
This code is wrong as-is and this patch fixes it for free.
Later when I figure out what to do with our main issue - memory, I'll consider this micro optimizations.

vitalybuka abandoned this revision.May 24 2023, 5:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 5:27 PM
Herald added a subscriber: Enna1. · View Herald Transcript