OSDN Git Service

Use set_sched_policy to put dexopt operations in SP_BACKGROUND cgroup
authorBrian Carlstrom <bdc@google.com>
Fri, 8 Aug 2014 07:52:22 +0000 (00:52 -0700)
committerBrian Carlstrom <bdc@google.com>
Sat, 9 Aug 2014 05:10:06 +0000 (22:10 -0700)
Bug: 15927194
Change-Id: Id8bc188de68d62fd5f91a99aaaa6c8f2dea06abd

cmds/installd/commands.c

index c25af59..cd53355 100644 (file)
@@ -17,6 +17,7 @@
 #include <inttypes.h>
 #include <sys/capability.h>
 #include "installd.h"
+#include <cutils/sched_policy.h>
 #include <diskusage/dirsize.h>
 #include <selinux/android.h>
 
@@ -939,6 +940,10 @@ int dexopt(const char *apk_path, uid_t uid, int is_public,
             ALOGE("capset failed: %s\n", strerror(errno));
             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) {
             ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno));
             exit(67);