Merge "Check for /dev/memcg/system/tasks before writing to it"
This commit is contained in:
@@ -937,7 +937,10 @@ static jint com_android_internal_os_Zygote_nativeForkSystemServer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assign system_server to the correct memory cgroup.
|
// Assign system_server to the correct memory cgroup.
|
||||||
if (!WriteStringToFile(StringPrintf("%d", pid), "/dev/memcg/system/tasks")) {
|
// Not all devices mount /dev/memcg so check for the file first
|
||||||
|
// to avoid unnecessarily printing errors and denials in the logs.
|
||||||
|
if (!access("/dev/memcg/system/tasks", F_OK) &&
|
||||||
|
!WriteStringToFile(StringPrintf("%d", pid), "/dev/memcg/system/tasks")) {
|
||||||
ALOGE("couldn't write %d to /dev/memcg/system/tasks", pid);
|
ALOGE("couldn't write %d to /dev/memcg/system/tasks", pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user