am 82e98c21: Merge "Use set_sched_policy to put dexopt operations in SP_BACKGROUND cgroup"

* commit '82e98c21f8606e0de8c6beb4372bc4ae9f52b515':
  Use set_sched_policy to put dexopt operations in SP_BACKGROUND cgroup
This commit is contained in:
Narayan Kamath 2014-08-11 17:36:11 +00:00 committed by Android Git Automerger
commit 93b1b9a42c

View File

@ -17,6 +17,7 @@
#include <inttypes.h> #include <inttypes.h>
#include <sys/capability.h> #include <sys/capability.h>
#include "installd.h" #include "installd.h"
#include <cutils/sched_policy.h>
#include <diskusage/dirsize.h> #include <diskusage/dirsize.h>
#include <selinux/android.h> #include <selinux/android.h>
@ -950,6 +951,10 @@ int dexopt(const char *apk_path, uid_t uid, int is_public,
ALOGE("capset failed: %s\n", strerror(errno)); ALOGE("capset failed: %s\n", strerror(errno));
exit(66); exit(66);
} }
if (set_sched_policy(0, SP_BACKGROUND) < 0) {
ALOGE("set_sched_policy failed: %s\n", strerror(errno));
exit(70);
}
if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) { if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) {
ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno)); ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno));
exit(67); exit(67);