[all-commits] [llvm/llvm-project] 072669: sanitizer_common: optimize memory drain

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Mon Jul 12 10:21:28 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 072669521456a369409cf9db30739a3fac740173
      https://github.com/llvm/llvm-project/commit/072669521456a369409cf9db30739a3fac740173
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-07-12 (Mon, 12 Jul 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h
    M compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cpp

  Log Message:
  -----------
  sanitizer_common: optimize memory drain

Currently we allocate MemoryMapper per size class.
MemoryMapper mmap's and munmap's internal buffer.
This results in 50 mmap/munmap calls under the global
allocator mutex. Reuse MemoryMapper and the buffer
for all size classes. This radically reduces number of
mmap/munmap calls. Smaller size classes tend to have
more objects allocated, so it's highly likely that
the buffer allocated for the first size class will
be enough for all subsequent size classes.

Reviewed By: melver

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




More information about the All-commits mailing list