[PATCH] D82397: [scudo][standalone] mallopt runtime configuration options

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 11:15:53 PDT 2020


cryptoad created this revision.
cryptoad added reviewers: cferris, hctim, pcc, eugenis.
Herald added subscribers: Sanitizers, jfb.
Herald added a project: Sanitizers.

Partners have requested the ability to configure more parts of Scudo
at runtime, notably the Secondary cache options (maximum number of
blocks cached, maximum size) as well as the TSD registry options
(the maximum number of TSDs in use).

This CL adds a few more Scudo specific `mallopt` parameters that are
passed down to the various subcomponents of the Combined allocator.

- `M_CACHE_COUNT_MAX`: sets the maximum number of Secondary cached items
- `M_CACHE_SIZE_MAX`: sets the maximum size of a cacheable item in the Secondary
- `M_TSDS_COUNT_MAX`: sets the maximum number of TSDs that can be used (Shared Registry only)

Regardinbg the TSDs maximum count, this is a one way option, only
allowing to increase the count.

In order to allow for this, I rearranged the code to have some `setOption`
member function to the relevant classes, using the `scudo::Option` class
enum to determine what is to be set.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82397

Files:
  compiler-rt/lib/scudo/standalone/allocator_config.h
  compiler-rt/lib/scudo/standalone/combined.h
  compiler-rt/lib/scudo/standalone/common.h
  compiler-rt/lib/scudo/standalone/primary32.h
  compiler-rt/lib/scudo/standalone/primary64.h
  compiler-rt/lib/scudo/standalone/secondary.h
  compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
  compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
  compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
  compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
  compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
  compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
  compiler-rt/lib/scudo/standalone/tsd_exclusive.h
  compiler-rt/lib/scudo/standalone/tsd_shared.h
  compiler-rt/lib/scudo/standalone/wrappers_c.h
  compiler-rt/lib/scudo/standalone/wrappers_c.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82397.272773.patch
Type: text/x-patch
Size: 35885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200623/adb0d3df/attachment-0001.bin>


More information about the llvm-commits mailing list