[scudo][standalone] Allow the release of smaller sizes
authorKostya Kortchinsky <kostyak@google.com>
Fri, 11 Dec 2020 22:04:47 +0000 (14:04 -0800)
committerKostya Kortchinsky <kostyak@google.com>
Thu, 17 Dec 2020 18:01:57 +0000 (10:01 -0800)
commit1dbf2c96bce93e0a954806d9bdcafcb702a06672
tree4970d3686b344a8407df48908f13774e505181aa
parent4a327bd25289efdfb1c466b119e6e55fadebfc42
[scudo][standalone] Allow the release of smaller sizes

Initially we were avoiding the release of smaller size classes due to
the fact that it was an expensive operation, particularly on 32-bit
platforms. With a lot of batches, and given that there are a lot of
blocks per page, this was a lengthy operation with little results.

There has been some improvements since then to the 32-bit release,
and we still have some criterias preventing us from wasting time
(eg, 9x% free blocks in the class size, etc).

Allowing to release blocks < 128 bytes helps in situations where a lot
of small chunks would not have been reclaimed if not for a forced
reclaiming.

Additionally change some `CHECK` to `DCHECK` and rearrange a bit the
code.

I didn't experience any regressions in my benchmarks.

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