[scudo] Early exit from the case can't do page release.
authorChia-hung Duan <chiahungduan@google.com>
Wed, 22 Mar 2023 21:46:23 +0000 (21:46 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Wed, 22 Mar 2023 21:46:40 +0000 (21:46 +0000)
commitfb8d894f23c5e805f0c87d89fb9d6c0eed3a0e72
tree3d94a74f2d5cd9280bcfa7e13740d5aad8d29462
parent4d18d97b594ccaa3cbd79beb4afef45e4156dc8d
[scudo] Early exit from the case can't do page release.

There are heuristics to avoid marking blocks if there's little chance
to release pages. So far, those logics only exist in block-marking
section and we didn't leverage the results of those logics. For example,
in a round of releaseToOS try, we know it's still 128 KB away from the
release threshold. In the next round of releaseToOS, we can early exit
if the number of pushed bytes is smaller than 128 KB without looping
each memory group. This CL adds this heuristic and has reduced amount of
time in checking the status of each memory group.

This CL only applies this heuristic on SizeClassAllocator64.
SizeClassAllocator32 has a smaller region/group size and has little
impact on the default value.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D146312
compiler-rt/lib/scudo/standalone/primary64.h