[PATCH] D33454: [sanitizer] Change the 32-bit Primary AllocateRegion to reduce fragmentation

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 17:58:22 PDT 2017


cryptoad added a comment.

In https://reviews.llvm.org/D33454#762799, @alekseyshl wrote:

> How about having a stash for one region in SizeClassInfo? You won't need more than one since sci is locked and it is available when AllocateRegion is called, just pass it there.


I thought about it since you mentioned it in your initial suggestion. It's not improbable to have several "hanging" regions within SCI that wouldn't be used for a while. With 52 classes, worst case scenario would be 51MB of VA lost in stashes, but likely several MB.
I feel like having a common stash, while adding a mutex, allows to avoid this, but repurposing the stashed ones pretty quick.



================
Comment at: lib/sanitizer_common/sanitizer_allocator_primary32.h:314
+      MapUnmapCallback().OnMap(res, map_size);
+      stat->Add(AllocatorStatMapped, map_size);
+    }
----------------
alekseyshl wrote:
> I'd move the allocation into separate private function anyway.
Will do.


https://reviews.llvm.org/D33454





More information about the llvm-commits mailing list