[PartitionAlloc] Add feature to use fewer memory regions.

PartitionAlloc creates a lot of memory regions in its current
configuration, up to 10s of thousands, due to the way it manipulates
page permissions. This is problematic on Linux-based systems, where
there is a per-process limit of memory regions (VMAs), which is a bit
under 2^16 by default, and we sometimes see crashes likely due to
reaching this limit.

This commit adds a feature to use fewer regions in
PartitionAlloc. Locally, on Linux, loading google maps, we see:

Before:
$ wc -l /proc/${pid}/maps
4497 /proc/582913/maps

After:
$ wc -l /proc/${pid}/maps
1900 /proc/551934/maps

That is, the *total* number of regions is <1/2 with the feature
enabled. For more details about the mechanism, see the comment in
PartitionBucket::SlotSpanCommittedSize().

Bug: 385400561
Change-Id: I22b0f07860e92c43a5414742d9a3b5565410ef3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6157842
Reviewed-by: Takashi Sakamoto <tasak@google.com>
Reviewed-by: Sergei Glazunov <glazunov@google.com>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404104}
NOKEYCHECK=True
GitOrigin-RevId: 53690081eb7c8ce64dd74e1f690918f27b7e45ff
9 files changed