[all-commits] [llvm/llvm-project] 560067: [sanitizer] Set the min size to allocate for the L...

PiJoules via All-commits all-commits at lists.llvm.org
Mon Aug 28 16:05:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 56006757a0914ce882d5f507031bb5d010a55a2b
      https://github.com/llvm/llvm-project/commit/56006757a0914ce882d5f507031bb5d010a55a2b
  Author: Leonard Chan <leonardchan at google.com>
  Date:   2023-08-28 (Mon, 28 Aug 2023)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp

  Log Message:
  -----------
  [sanitizer] Set the min size to allocate for the LowLevelAllocator to
65536 bytes

The LowLevelAllocator is a helper class used by many sanitizer internals
for anonymously mmaping stuff. The allocator (usually) maps one page at
a time, but this can lead to a lot of fragmentation if the allocator is
heavily used. The flag parser is an example of this where it needs to do
lots of string copying that need to exist for a variable length of time.

This adds a macro for specifying the number of pages the LowLevelAllocator
can make at a time, which locally I've found to significantly help reduce
fragmentation and help run the scudo allocator tests in an asan-instrumented
build on riscv Sv39. This is a static macro rather than a value that could
be provided via an env variable because flag parsing is one of the earliest
consumers of the LowLevelAllocator, so this should be set before its ever used.

Note this will mainly help instances of the LowLevelAllocator that are heavily
used, but instances of the LowLevelAllocator that do a small fixed number
of allocations won't benefit as much from this. This can be alleviated though
if we instead consolidate all of them to one single LowLevelAllocator (D158786).

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




More information about the All-commits mailing list