[all-commits] [llvm/llvm-project] 19ea1d: [scudo][standalone] Add a free list to the Secondary

Kostya Kortchinsky via All-commits all-commits at lists.llvm.org
Wed Oct 30 09:06:40 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 19ea1d46ccfe7decd623ba3f860d8ba7a9f1bb44
      https://github.com/llvm/llvm-project/commit/19ea1d46ccfe7decd623ba3f860d8ba7a9f1bb44
  Author: Kostya Kortchinsky <kostyak at google.com>
  Date:   2019-10-30 (Wed, 30 Oct 2019)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/CMakeLists.txt
    M compiler-rt/lib/scudo/standalone/allocator_config.h
    M compiler-rt/lib/scudo/standalone/combined.h
    R compiler-rt/lib/scudo/standalone/secondary.cpp
    M compiler-rt/lib/scudo/standalone/secondary.h
    M compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp

  Log Message:
  -----------
  [scudo][standalone] Add a free list to the Secondary

Summary:
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.

Reviewers: hctim, morehouse, cferris, pcc, eugenis, vitalybuka

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D69570




More information about the All-commits mailing list