[PATCH] D61745: [scudo][standalone] Introduce the Primary(s) and LocalCache

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 11:15:09 PDT 2019


cryptoad created this revision.
cryptoad added reviewers: vitalybuka, eugenis, morehouse, hctim.
Herald added subscribers: Sanitizers, jfb, delcypher, mgorny, srhines.
Herald added projects: LLVM, Sanitizers.

This CL introduces the 32 & 64-bit primary allocators, and associated
Local Cache. While the general idea is mostly similar to what exists
in sanitizer_common, it departs from the original code somewhat
significantly:

- the 64-bit primary no longer uses a free array at the end of a region but uses batches of free blocks in region 0, allowing for a convergence with the 32-bit primary behavior;
- as a result, there is only one (templated) local cache type for both primary allocators, and memory reclaiming can be implemented similarly for the 32-bit & 64-bit platforms;
- 64-bit primary regions are handled a bit differently: we do not reserve 4TB of memory that we split, but reserve `NumClasses * 2^RegionSizeLog`, each region being offseted by a random number of pages from its computed base. A side effect of this is that the 64-bit primary works on 32-bit platform (I don't think we want to encourage it but it's an interesting side effect);


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D61745

Files:
  lib/scudo/standalone/CMakeLists.txt
  lib/scudo/standalone/local_cache.h
  lib/scudo/standalone/primary32.h
  lib/scudo/standalone/primary64.h
  lib/scudo/standalone/tests/CMakeLists.txt
  lib/scudo/standalone/tests/primary_test.cc
  lib/scudo/standalone/tests/secondary_test.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61745.198876.patch
Type: text/x-patch
Size: 42209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190509/623de637/attachment.bin>


More information about the llvm-commits mailing list