This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Dump MapAllocatorCache::retrieve() data
ClosedPublic

Authored by frs513 on Aug 4 2023, 4:04 PM.

Details

Summary

Keeps track of CallsToRetrieve, how many SuccessfulRetrieves, and
total WastedBytes from cached block allocations. Dumps this data in the
MapAllocatorCache::getStats() function

Diff Detail

Event Timeline

frs513 created this revision.Aug 4 2023, 4:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2023, 4:04 PM
Herald added subscribers: yaneury, Enna1. · View Herald Transcript
frs513 requested review of this revision.Aug 4 2023, 4:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2023, 4:04 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
cferris requested changes to this revision.Aug 4 2023, 4:39 PM

Small question.

compiler-rt/lib/scudo/standalone/secondary.h
437

Looks like an extra line snuck in here.

Did you run clang format on this? I don't know if it would have removed this line.

This revision now requires changes to proceed.Aug 4 2023, 4:39 PM
frs513 updated this revision to Diff 547406.Aug 4 2023, 4:53 PM

ran git clang-format

cferris accepted this revision.Aug 4 2023, 4:54 PM

LGTM, but give Chia-hung a chance to comment too.

This revision is now accepted and ready to land.Aug 4 2023, 4:54 PM
frs513 marked an inline comment as done.Aug 4 2023, 4:55 PM
frs513 added inline comments.
compiler-rt/lib/scudo/standalone/secondary.h
437

I just re-uploaded after running clang format

frs513 marked an inline comment as done.Aug 4 2023, 5:57 PM
frs513 updated this revision to Diff 547436.Aug 4 2023, 6:58 PM

added check for dividing by zero case

cferris accepted this revision.Aug 4 2023, 7:02 PM

Yeah, I should have checked for a divide by zero. Unfortunately, on arm that doesn't actually crash.

Chia-hungDuan added inline comments.Aug 7 2023, 9:19 AM
compiler-rt/lib/scudo/standalone/secondary.h
170

How about adding Cache before this? To make the info down below more clear

172

As discussed, I think the occurrence is useful as well, how about let's do it like

64 / 128 (50%)
172

I'm wondering what the value will hint us. It seems to me the accumulated value may give limited information and may be misleading. For example, does higher wasted bytes indicate bad cache strategy? Not exactly, if it always maintains good SuccessfulRetrieves, then that may have less impact.

Don't get me wrong, we still want to review that value when we are tuning the cache algorithm but in terms of general stats, we may want to provide some information which are less ambiguous.

Therefore, I may suggest removing the WastedBytes

frs513 marked an inline comment as done.Aug 7 2023, 10:58 AM
frs513 added inline comments.
compiler-rt/lib/scudo/standalone/secondary.h
172

I am currently outputting the fractional and percent values for the Success Rate.

172

For WastedBytes would it be a good idea to update that value when we store a cached block as well? or just remove it for now since it is ambiuous?

Chia-hungDuan added inline comments.Aug 7 2023, 11:03 AM
compiler-rt/lib/scudo/standalone/secondary.h
172

Oops, my bad! You're doing what I was suggesting. Ignore this comment :)

172

I may just remove it or let's discuss what you have in mind offline before making the decision

frs513 marked 2 inline comments as done.Aug 7 2023, 11:18 AM
frs513 updated this revision to Diff 548006.Aug 7 2023, 5:28 PM

got rid of WastedBytes tracking, will add in a seperate cl

frs513 marked 2 inline comments as done.Aug 7 2023, 5:30 PM
Chia-hungDuan accepted this revision.Aug 7 2023, 5:35 PM

Per discussion, the *WastedBytes* will be presented in a different way which tells how many bytes are unused in secondary blocks. @frs513 will do it in a separate CL

I will merge this change

This revision was landed with ongoing or failed builds.Aug 7 2023, 6:33 PM
This revision was automatically updated to reflect the committed changes.