[PATCH] D49217: [XRay][compiler-rt] Simplify Allocator Implementation

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 00:06:42 PDT 2018


dberris created this revision.
dberris added reviewers: kpw, eizan.

This change simplifies the XRay Allocator implementation to self-manage
an mmap'ed memory segment instead of using the internal allocator
implementation in sanitizer_common.

We've found through benchmarks and profiling these benchmarks in https://reviews.llvm.org/D48879
that using the internal allocator in sanitizer_common introduces a
bottleneck on allocating memory through a central spinlock. This change
allows thread-local allocators to eliminate contention on the
centralized allocator.

To get the most benefit from this approach, we also use a managed
allocator for the chunk elements used by the segmented array
implementation. This gives us the chance to amortize the cost of
allocating memory when creating these internal segmented array data
structures.

We also took the opportunity to remove the preallocation argument from
the allocator API, simplifying the usage of the allocator throughout the
profiling implementation.

In this change we also tweak some of the flag values to reduce the
amount of maximum memory we use/need for each thread, when requesting
memory through mmap.

Depends on https://reviews.llvm.org/D48956.


https://reviews.llvm.org/D49217

Files:
  compiler-rt/lib/xray/tests/unit/allocator_test.cc
  compiler-rt/lib/xray/tests/unit/function_call_trie_test.cc
  compiler-rt/lib/xray/tests/unit/segmented_array_test.cc
  compiler-rt/lib/xray/xray_allocator.h
  compiler-rt/lib/xray/xray_function_call_trie.h
  compiler-rt/lib/xray/xray_profile_collector.cc
  compiler-rt/lib/xray/xray_profiling.cc
  compiler-rt/lib/xray/xray_profiling_flags.inc
  compiler-rt/lib/xray/xray_segmented_array.h
  compiler-rt/lib/xray/xray_utils.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49217.155120.patch
Type: text/x-patch
Size: 36075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180712/5ea12f8b/attachment-0001.bin>


More information about the llvm-commits mailing list