Fix race applying SystemMemoryProcess for system_server
When UsePerAppMemcg is true, we intend for system_server to be placed in the root of the system memcg instead of its own per-app memcg. The current implementation suffers from a race, since the memcg migration is performed by the parent process (Zygote) when there is no guarantee cgroup setup (createProcessGroup) has been completed in the child. This can result in system_server being migrated to the system memcg initially only to be migrated again later to a per-app memcg. Fix this by moving the system_server migration from Zygote to system_server after cgroup setup is completed. Test: $ adb wait-for-device shell 'grep memory /proc/`pidof system_server`/cgroup' Test: 4:memory:/system Flag: EXEMPT bugfix Bug: 434785097 Change-Id: I0952e747325a4cdeefe7491566293fd33230d2b4
Loading
Please register or sign in to comment