Track SchedulerLoopQuarantine zap/purge timings

Currently SchedulerLoopQuarantine has two potentially expensive
operations inside it. Zapping (memseting free'd objects to a known byte
pattern) and purging (managing a list of free'd pointers to keep the
quarantine under the configured memory amount).

This adds the ability to configure a new parameter
'enable-quarantine-runtime-stats' which will report these times to UMA
periodically (30 seconds) for the last 1024 allocations in a given
PartitionAlloc bucket.

Also implement a pause functionality where slow zapping performance can
cause the quarantine to stop zapping objects. This is to investigate if
stopping during periods of memory contention would address the
performance concerns seen or not. This isn't fully desired to launch due
to the negative security effects but could be useful in testing the
impact.

You can test this locally with the following:

--enable-features="PartitionAllocWithAdvancedChecks,PartitionAllocSchedulerLoopQuarantine:PartitionAllocSchedulerLoopQuarantineConfig/{\"browser\"%3A{\"main\"%3A{\"branch-capacity-in-bytes\"%3A524288%2C\"enable-quarantine\"%3Atrue%2C\"enable-zapping\"%3Atrue%2C\"leak-on-destruction\"%3Afalse%2C\"enable-quarantine-runtime-stats\"%3Atrue%2C\"pause-duration-us\"%3A10000000%2C\"max-zap-above-avg-before-pause-us\"%3A500000}}},PartitionAllocSchedulerLoopQuarantineTaskObserverForBrowserUIThread"

Change-Id: I52daa6ef9e6b8c96f00ba7acaa2233cc38aa5aa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7069804
Commit-Queue: Stephen Nusko <nuskos@chromium.org>
Auto-Submit: Stephen Nusko <nuskos@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1539132}
NOKEYCHECK=True
GitOrigin-RevId: 908886263178aab22f731d12a3ef5bcc726043a0
1 file changed