From b0780bfd9361257ca7def75aaccb1411e6b77265 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Fri, 8 Aug 2014 00:52:22 -0700 Subject: [PATCH] Use set_sched_policy to put dexopt operations in SP_BACKGROUND cgroup Bug: 15927194 (cherry picked from commit 0378aaf257aee92539d30543914a50c4481c6a18) Change-Id: I462b5ac256c4d091ed4023cf4b97dd6a4abcaa5f --- cmds/installd/commands.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c index bd721c892b..f05ce617ae 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -17,6 +17,7 @@ #include #include #include "installd.h" +#include #include #include @@ -950,6 +951,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); -- 2.11.0