base/allocator: Name anonymous mappings on Android.

On Android, it is possible to set a name to an anonymous mapping. This name is
visible in /proc/[PID]/maps. This is already used in various ways: by the system
allocator, ART, for BSS segments, the GC, etc.

This adds support for naming regions to pages allocated with PageAllocator, that
is PartitionAlloc, Oilpan and V8. Right now, only V8 pages are separated from
the general bucket.

This is useful mostly for debugging and memory analysis, including checking
metrics reporting and assessing fragmentation.

Example output, from a renderer, looking at /proc/[PID]/smaps:

35edf000-36000000 ---p 00000000 00:00 0                                  [anon:chromium]
Name:           [anon:chromium]
Size:               1156 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                   0 kB
Pss:                   0 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            0 kB
Anonymous:             0 kB
AnonHugePages:         0 kB
Swap:                  0 kB
SwapPss:               0 kB
Locked:                0 kB
VmFlags: mr mw me
36840000-36880000 rw-p 00000000 00:00 0                                  [anon:v8]
Name:           [anon:v8]
Size:                256 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                   4 kB
Pss:                   4 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         4 kB
Referenced:            4 kB
Anonymous:             4 kB
AnonHugePages:         0 kB
Swap:                  0 kB
SwapPss:               0 kB
Locked:                0 kB
VmFlags: rd wr mr mw me ac

Bug: 998048
Change-Id: I0e109bcfb6090fd111c2a3fa80b6656417ff72a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1769451
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690723}
2 files changed