[all-commits] [llvm/llvm-project] 6f00f3: [scudo][standalone] mallopt runtime configuration ...

Kostya Kortchinsky via All-commits all-commits at lists.llvm.org
Tue Jul 28 11:58:25 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f00f3b56e5a13286142facd929be15ab7b17aa3
      https://github.com/llvm/llvm-project/commit/6f00f3b56e5a13286142facd929be15ab7b17aa3
  Author: Kostya Kortchinsky <kostyak at google.com>
  Date:   2020-07-28 (Tue, 28 Jul 2020)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/allocator_config.h
    M compiler-rt/lib/scudo/standalone/combined.h
    M compiler-rt/lib/scudo/standalone/common.h
    M compiler-rt/lib/scudo/standalone/include/scudo/interface.h
    M compiler-rt/lib/scudo/standalone/primary32.h
    M compiler-rt/lib/scudo/standalone/primary64.h
    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/primary_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
    M compiler-rt/lib/scudo/standalone/tsd_exclusive.h
    M compiler-rt/lib/scudo/standalone/tsd_shared.h

  Log Message:
  -----------
  [scudo][standalone] mallopt runtime configuration options

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

Regarding 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.

This also fixes an issue where a static variable (`Ready`) was used in
templated functions without being set back to `false` every time.

Reviewers: pcc, eugenis, hctim, cferris

Subscribers: jfb, llvm-commits, #sanitizers

Tags: #sanitizers

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




More information about the All-commits mailing list