Commit da5951e6 authored by Anton Bikineev's avatar Anton Bikineev Committed by Commit Bot

PartitionAlloc: PCScan: Move UsesGigaCage check out of the scan loop

This improves scanning time by... 36x (from 116ms to 3ms) on cnn:2020.
As a bonus, it fixes some of the test failures.

Bug: 11297512
Change-Id: I826c338ca19bec5815c0c16aedb7f9222f110a44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2544942
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
Commit-Queue: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828578}
parent 3ecca67a
...@@ -256,6 +256,8 @@ size_t NO_SANITIZE("thread") PCScan<thread_safe>::PCScanTask::ScanRange( ...@@ -256,6 +256,8 @@ size_t NO_SANITIZE("thread") PCScan<thread_safe>::PCScanTask::ScanRange(
static_assert(alignof(uintptr_t) % alignof(void*) == 0, static_assert(alignof(uintptr_t) % alignof(void*) == 0,
"Alignment of uintptr_t must be at least as strict as " "Alignment of uintptr_t must be at least as strict as "
"alignment of a pointer type."); "alignment of a pointer type.");
const bool uses_giga_cage = root_.UsesGigaCage();
(void)uses_giga_cage;
size_t new_quarantine_size = 0; size_t new_quarantine_size = 0;
for (uintptr_t* payload = begin; payload < end; ++payload) { for (uintptr_t* payload = begin; payload < end; ++payload) {
...@@ -269,7 +271,7 @@ size_t NO_SANITIZE("thread") PCScan<thread_safe>::PCScanTask::ScanRange( ...@@ -269,7 +271,7 @@ size_t NO_SANITIZE("thread") PCScan<thread_safe>::PCScanTask::ScanRange(
#if defined(PA_HAS_64_BITS_POINTERS) #if defined(PA_HAS_64_BITS_POINTERS)
// On partitions without extras (partitions with aligned allocations), // On partitions without extras (partitions with aligned allocations),
// memory is not allocated from the GigaCage. // memory is not allocated from the GigaCage.
if (root_.UsesGigaCage()) { if (uses_giga_cage) {
// With GigaCage, we first do a fast bitmask check to see if the // With GigaCage, we first do a fast bitmask check to see if the
// pointer points to the normal bucket pool. // pointer points to the normal bucket pool.
if (!PartitionAddressSpace::IsInNormalBucketPool( if (!PartitionAddressSpace::IsInNormalBucketPool(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment