[scudo] Use bytes-in-freelist as a hint of page release
authorChia-hung Duan <chiahungduan@google.com>
Fri, 24 Mar 2023 17:06:29 +0000 (17:06 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Fri, 24 Mar 2023 17:10:49 +0000 (17:10 +0000)
commite74834f9bb6bb608e00e2cd230cb3b63df0803b9
treea70a6da14571a62c41719460db4c70f5f4319ad3
parent70022e5bbf84db449ef7d72c1adb4d6094785aae
[scudo] Use bytes-in-freelist as a hint of page release

Tracking the pushed bytes between to releaseToOSMaybe calls may lead to
a overestimated case that if we do malloc 2KB -> free 2KB -> malloc 2KB
-> free 2KB, we may think we have released 4KB but it only releases 2KB
actually. Switch to use bytes-in-freelist excludes more cases that can't
release the pages

Reviewed By: cferris

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