[compiler-rt] [compiler-rt][fuchsia] Preallocate a vmar for sanitizer internals (PR #75256)
Roland McGrath via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 17:35:21 PST 2024
================
@@ -129,6 +129,55 @@ uptr GetMaxVirtualAddress() { return GetMaxUserVirtualAddress(); }
bool ErrorIsOOM(error_t err) { return err == ZX_ERR_NO_MEMORY; }
+// For any sanitizer internal that needs to map something which can be unmmaped
+// later, first attempt to map to a pre-allocated vmar. This helps reduce
+// fragmentation from many small anonymous mmap calls. A good value for this
+// vmar size would be the total size of your typical sanitizer internal objects
+// allocated in an "average" process lifetime. Examples of this include:
+// FakeStack, LowLevelAllocator mappings, TwoLevelMap, InternalMmapVector,
+// StackStore, CreateAsanThread, etc.
+//
+// 0xc52000 is ~12.32MB. This is roughly equal to the total sum of sanitizer
+// internal mappings in a run of boot-libc-unittests.
----------------
frobtech wrote:
I don't think we should be referring to individual Fuchsia tree things here. We can say things more generic like "a large test case". Let's use a more round number. If ~12.32MiB is a good number, then 13MiB is a good number, and you can write that as `13 << 20; // 13 MiB` or something more readable like that.
https://github.com/llvm/llvm-project/pull/75256
More information about the llvm-commits
mailing list