[PATCH] D73507: [scudo][standalone] Secondary & general other improvements

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 14:07:09 PST 2020


cryptoad created this revision.
cryptoad added reviewers: cferris, pcc, eugenis, morehouse, hctim.
Herald added subscribers: Sanitizers, phosek.
Herald added projects: Sanitizers, LLVM.

This CL changes multiple things to improve performance (notably on
Android).We introduce a cache class for the Secondary that is taking
care of this mechanism now.

The changes:

- change the Secondary "freelist" to an array. By keeping free secondary blocks linked together through their headers, we were keeping a page per block, which isn't great. Also we know touch less pages when walking the new "freelist".
- fix an issue with the freelist getting full: if the pattern is an ever increasing size malloc then free, the freelist would fill up and entries would not be used. So now we empty the list if we get to many "full" events;
- use the global release to os interval option for the secondary: it was too costly to release all the time, particularly for pattern that are malloc(X)/free(X)/malloc(X). Now the release will only occur after the selected interval, when going through the deallocate path;
- allow release of the `BatchClassId` class: it is releasable, we just have to make sure we don't mark the batches containing batches pointers as free.
- change the default release interval to 1s for Android to match the current Bionic allocator configuration. A patch is coming up to allow changing it through `mallopt`.
- lower the smallest class that can be released to `PageSize/64`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73507

Files:
  compiler-rt/lib/scudo/standalone/allocator_config.h
  compiler-rt/lib/scudo/standalone/combined.h
  compiler-rt/lib/scudo/standalone/flags.inc
  compiler-rt/lib/scudo/standalone/primary32.h
  compiler-rt/lib/scudo/standalone/primary64.h
  compiler-rt/lib/scudo/standalone/release.h
  compiler-rt/lib/scudo/standalone/secondary.h
  compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
  compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73507.240680.patch
Type: text/x-patch
Size: 20148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200127/5987e98e/attachment.bin>


More information about the llvm-commits mailing list