[PATCH] D69570: [scudo][standalone] Add a free list to the Secondary

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 09:48:54 PDT 2019


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

The secondary allocator is slow, because we map and unmap each block
on allocation and deallocation.

While I really like the security benefits of such a behavior, this
yields very disappointing performance numbers on Android for larger
allocation benchmarks.

So this change adds a free list to the secondary, that will hold
recently deallocated chunks, and (currently) release the extraneous
memory. This allows to save on some memory mapping operations on
allocation and deallocation. I do not think that this lowers the
security of the secondary, but can increase the memory footprint a
little bit (RSS & VA).

The maximum number of blocks the free list can hold is templatable,
`0U` meaning that we fallback to the old behavior. The higher that
number, the higher the extra memory footprint.

I added default configurations for all our platforms, but they are
likely to change in the near future based on needs and feedback.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69570

Files:
  compiler-rt/lib/scudo/standalone/CMakeLists.txt
  compiler-rt/lib/scudo/standalone/allocator_config.h
  compiler-rt/lib/scudo/standalone/combined.h
  compiler-rt/lib/scudo/standalone/secondary.cpp
  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: D69570.226919.patch
Type: text/x-patch
Size: 17914 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191029/1d5179f7/attachment.bin>


More information about the llvm-commits mailing list