Replace ashmem in ART with prctl

ART use ashmem just for naming anonymous regions. This is a hack.
Further, we are moving away from ashmem in favor of native Linux based
shared-memory mechanims for Android. We already have a PRCTL for naming
maps in the Android kernels. Lets use that for Android.

This also results in removal of ashmem hacks for host-only builds.

As a side-effect, the naming of regions change from "/dev/ashmem/<name>"
to "[anon:<name>" so we need to update debug code in frameworks. Another
CL does that.

Note: The user pointers passed to the prctl should be available during
maps read time, so we cannot use pointers from the stack. To solve this,
we maintain an std::map of unique debug strings when we name the maps.
This doesn't result in more memory usage than before, since ashmem is
heavier storage-wise due to additional kernel data structure
allocations.

Performance of 'dumpsys meminfo' gone up by 25% (1s to 0.75s). Slab
memory consumption gone down by 3-5MB on boot.

Test: Boot and dumpsys meminfo before/after
Bug: 111903542
Internal gerrit: ag/4827680
Change-Id: Ia658fce62977f6c69dc4ce89ffdcfe2d9ae22738
Signed-off-by: Joel Fernandes <joelaf@google.com>
4 files changed