This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Force release after burst of deallocs
AbandonedPublic

Authored by cryptoad on Apr 22 2020, 10:01 AM.

Details

Reviewers
None
Summary

Some situations are fairly adversarial to Scudo, notably when there is
a lot of allocations in a small class size followed by deallocations.
Since we do not release those except on forced-release, we end up with
a higher RSS that's not going away.

Since releasing smaller classes is expensive (on 32-bit), I tried to
find the most balanced way to proceed. The point of this change is to
force-release classes when the % of freed chunks in a class size is very
high (in the 9x% area), and if the number of blocks pushed in the
freelist since last release is also high (I set that to 25%).

A very small size class (16 bytes) won't release significant memory
unless it's mostly empty (98-99%) due to randomization.

There is a small drawback when an application does an M_PURGE shortly
after a burst a deallocation, then we end up going through the release
code twice as we still want to fulfill the release request, and it turns
out to be a net slowdown on some 32-bit benchmarks.

Diff Detail

Event Timeline

cryptoad created this revision.Apr 22 2020, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2020, 10:01 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
cryptoad abandoned this revision.May 19 2020, 8:27 AM