• Mark Mentovai's avatar
    PartitionAlloc: Set the thread cache threshold by size, not bucket index · dd5c3642
    Mark Mentovai authored
    The bucket index is needed internally, but it can be computed from the
    threshold size rather than being hard-coded.
    
    This was partially fixed by 94069728
    (https://chromium-review.googlesource.com/c/2428896) which added a
    constant for the threshold size which can be checked by PA_CHECK.
    Unfortunately, that new CHECK was violated on mac-arm64, where the
    environment reports that the system allocator guarantees a minimum
    8-byte alignment, thus the bucket corresponding to allocation size 512
    occurs at a higher index than other 64-bit platforms, where the
    environment reports a minimum 16-byte alignment. It’s possible that the
    alignment reported on mac-arm64 is a bug, because the system allocator
    does in fact impose a 16-byte minimum alignment, but perhaps it believes
    that while this is true, it’s only guaranteeing 8-byte alignment.
    
    Regardless, the new PA_CHECK did catch that the thread cache threshold
    was not tuned as expected on mac-arm64. It seems to be intended to have
    used 512 everywhere, but 256 was being used on mac-arm64 instead.
    
    Bug: 1135726
    Change-Id: Ic820842d2a6eb669a0a65afb68c34638adf598d6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2463445
    Commit-Queue: Mark Mentovai <mark@chromium.org>
    Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#816239}
    dd5c3642
thread_cache.h 8.67 KB