[scudo] Mitigate page releasing thrashing
authorChia-hung Duan <chiahungduan@google.com>
Fri, 3 Mar 2023 19:21:11 +0000 (19:21 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Mon, 6 Mar 2023 16:38:18 +0000 (16:38 +0000)
commit436ea5485d02c529e26a7a1007b82d581be016c4
treef3d2353eece65f75b6bde90dd92f51e063a537eb
parent5b9d6097e78d7e3f7a48103057a767bc5a15faf1
[scudo] Mitigate page releasing thrashing

We have the heuristic to determine the threshold of doing page
releasing for smaller size classes. However, in a case that the
memory usage is bouncing between that threshold may result in
frequent try of page releasing but not returning much memory.

This CL add another heuristic to mitigate this problem by increasing
the minimum pages that potentially can be released. Note that this
heuristic is only applied on SizeClassAllocator64. SizeClassAllocator32
has a smaller group size so the overhead is smaller than 64-bit
platform.

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