PinnerService: Update support for pinning anon regions
This change does the following: * Fixes refresh of anon region pinning - The pinAnonRegion method was being called multiple times redundantly (e.g., for different users, or during startup). This resulted in duplicate pinnings of the same region size, potentially 3-4x the requested memory after a single boot. This is not safe even for experiments. Update behavior to listen to config changes and refresh accordingly, including releasing memory if the experiment flag is reset. * Changes the mapping from MAP_PRIVATE to MAP_SHARED - This avoids issues w/ downstream telemetry where rss.anon values (as read from /proc/*/status) trigger behavior like heap dumps/profiles. The memory region is still anonymous, and even appears as private dirty in showmap/dumpsys meminfo (due to the invalidating setMemory() call on the shared anon buffer), but in perfetto memory accounting, it falls under `mem.rss.shmem`. * Renames pin_anon_size to pin_shared_anon_size - As it's not safe to use the previous flag due to (1), and the semantics are changed slightly in (2), introduce a different name. Bug: 294079161 Test: device_config put runtime_native_boot \ pin_shared_anon_size 2000000000 Test: device_config put runtime_native_boot \ pin_shared_anon_size 0 Test: device_config delete runtime_native_boot \ pin_shared_anon_size Test: showmap `pidof system_server` Test: cat /proc/`pidof system_server`/status | grep 'Rss' Change-Id: I7c7c0dc76b9ff04c9cd05de25bfaed65372a56a0
Loading
Please register or sign in to comment