[PATCH] D39244: [sanitizer] Random shuffling of chunks for the 32-bit Primary Allocator

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 10:51:36 PDT 2017


alekseyshl added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_allocator_primary32.h:273
+    char padding[kCacheLineSize - 2 * sizeof(uptr) -
                  sizeof(IntrusiveList<TransferBatch>)];
   };
----------------
How about using [kCacheLineSize - offsetof(SizeClassInfo, padding)] instead?


================
Comment at: lib/sanitizer_common/sanitizer_allocator_primary32.h:341
+    const uptr kShuffleArraySize = 48;
+    uptr shuffle_array[kShuffleArraySize];
+    uptr j = 0;
----------------
How about using the newly allocated region for the array? You can fill and shuffle all the pointers at once, create the batches and then zero reg out. Still two passes, but less stack and chunks will be farther apart. The code will be simpler too and I have a feeling that we can even avoid double copying for !kShuffleArraySize.


================
Comment at: lib/sanitizer_common/sanitizer_common.h:933
+}
+
 }  // namespace __sanitizer
----------------
Yep, you're right, let's not pollute this file more than it is necessary and move it to sanitizer_allocator.h.


https://reviews.llvm.org/D39244





More information about the llvm-commits mailing list