diff options
author | Daniel Colascione | 2018-01-24 00:10:17 -0600 |
---|---|---|
committer | Gerrit Code Review | 2018-01-24 00:10:17 -0600 |
commit | ccb9960bebe4e8ec7d674d8d1b778e5cd9669b48 (patch) | |
tree | b8257cde288f153bf0e1301702fc94a71be9c603 | |
parent | 0ad424358c0e6937ba1d58d21721377cf4f03a95 (diff) | |
parent | d39adf2a4a51fdc027316afd800c24157056569c (diff) | |
download | platform-system-core-ccb9960bebe4e8ec7d674d8d1b778e5cd9669b48.tar.gz platform-system-core-ccb9960bebe4e8ec7d674d8d1b778e5cd9669b48.tar.xz platform-system-core-ccb9960bebe4e8ec7d674d8d1b778e5cd9669b48.zip |
Merge "Add MCL_ONFAULT to mlockall"
-rw-r--r-- | lmkd/lmkd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lmkd/lmkd.c b/lmkd/lmkd.c index fd83ecc28..b486a17c7 100644 --- a/lmkd/lmkd.c +++ b/lmkd/lmkd.c | |||
@@ -900,7 +900,16 @@ int main(int argc __unused, char **argv __unused) { | |||
900 | downgrade_pressure = (int64_t)property_get_int32("ro.lmk.downgrade_pressure", 60); | 900 | downgrade_pressure = (int64_t)property_get_int32("ro.lmk.downgrade_pressure", 60); |
901 | is_go_device = property_get_bool("ro.config.low_ram", false); | 901 | is_go_device = property_get_bool("ro.config.low_ram", false); |
902 | 902 | ||
903 | if (mlockall(MCL_CURRENT | MCL_FUTURE)) | 903 | // MCL_ONFAULT pins pages as they fault instead of loading |
904 | // everything immediately all at once. (Which would be bad, | ||
905 | // because as of this writing, we have a lot of mapped pages we | ||
906 | // never use.) Old kernels will see MCL_ONFAULT and fail with | ||
907 | // EINVAL; we ignore this failure. | ||
908 | // | ||
909 | // N.B. read the man page for mlockall. MCL_CURRENT | MCL_ONFAULT | ||
910 | // pins ⊆ MCL_CURRENT, converging to just MCL_CURRENT as we fault | ||
911 | // in pages. | ||
912 | if (mlockall(MCL_CURRENT | MCL_FUTURE | MCL_ONFAULT) && errno != EINVAL) | ||
904 | ALOGW("mlockall failed: errno=%d", errno); | 913 | ALOGW("mlockall failed: errno=%d", errno); |
905 | 914 | ||
906 | sched_setscheduler(0, SCHED_FIFO, ¶m); | 915 | sched_setscheduler(0, SCHED_FIFO, ¶m); |