This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Force release after burst of deallocs (64-b only)
AbandonedPublic

Authored by cryptoad on May 19 2020, 2:27 PM.

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, 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.

Diff Detail

Event Timeline

cryptoad created this revision.May 19 2020, 2:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2020, 2:27 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
cryptoad abandoned this revision.Jun 25 2020, 10:13 AM