This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Various improvements wrt RSS
ClosedPublic

Authored by cryptoad on Feb 25 2020, 2:24 PM.

Details

Summary

This patch includes several changes to reduce the overall footprint
of the allocator:

  • for realloc'd chunks: only keep the same chunk when lowering the size if the delta is within a page worth of bytes;
  • when draining a cache: drain the beginning, not the end; we add pointers at the end, so that meant we were draining the most recently added pointers;
  • change the release code to account for a "freed up" last page: when scanning the pages, we were looking for pages fully covered by blocks. In the event of the last page, if it's only partially covered, we wouldn't mark it as releasable - even if what follows the last chunk is all 0s. So now mark the rest of the page as releasable, and adapt the test;
  • add a missing setReleaseToOsIntervalMs to the cache-less secondary;
  • adjust the Android classes based on more captures thanks to pcc@'s tool.

Diff Detail

Event Timeline

cryptoad created this revision.Feb 25 2020, 2:24 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 25 2020, 2:24 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
cferris added inline comments.Feb 25 2020, 11:35 PM
compiler-rt/lib/scudo/standalone/tests/release_test.cpp
243

Should be scudo::uptr

cryptoad updated this revision to Diff 246726.Feb 26 2020, 7:38 AM
cryptoad marked an inline comment as done.

A scudo uptr snuck in instead of scudo::uptr.

cryptoad edited the summary of this revision. (Show Details)Feb 26 2020, 7:53 AM
cferris accepted this revision.Feb 26 2020, 10:01 AM

The performance is about the same as previous and it does shave about 1MB to 2MB of RSS in many cases. It also decrease the camera process by about 2MB.

It doesn't appear to affect the dex2oat RSS though.

This revision is now accepted and ready to land.Feb 26 2020, 10:01 AM
This revision was automatically updated to reflect the committed changes.