diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-05-18 00:55:53 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-05-18 00:55:53 +0000 |
commit | 1346a4012db4708dd3d502535419cffe921e6e62 (patch) | |
tree | 26bc5d206c2ab59bd337dd708040d072af2e5983 | |
parent | 60a47054998bc5644a80a885e937165efe260a84 (diff) | |
parent | 31f78ddf4ea2ab7963d873cb16db98e976346468 (diff) | |
download | core-nougat-mr2-pixel-release.tar.gz |
Merge cherrypicks of [2278225, 2279882, 2279862, 2278226, 2277057, 2279863, 2278227] into nyc-mr2-pixel-monthly-releaseandroid-7.1.2_r32android-7.1.2_r29android-7.1.2_r25android-7.1.2_r24android-7.1.2_r17android-7.1.2_r15nougat-mr2.2-releasenougat-mr2-pixel-release
Change-Id: I1ecb022752e056db772b9dc471529bc4ef335d7a
-rw-r--r-- | libcutils/sched_policy.c | 32 | ||||
-rw-r--r-- | rootdir/init.rc | 9 |
2 files changed, 3 insertions, 38 deletions
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c index 05a20481d..e11eb2e9e 100644 --- a/libcutils/sched_policy.c +++ b/libcutils/sched_policy.c @@ -56,10 +56,6 @@ static pthread_once_t the_once = PTHREAD_ONCE_INIT; static int __sys_supports_schedgroups = -1; -// File descriptors open to /dev/cpuctl/../tasks, setup by initialize, or -1 on error. -static int bg_cgroup_fd = -1; -static int fg_cgroup_fd = -1; - #ifdef USE_CPUSETS // File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error static int system_bg_cpuset_fd = -1; @@ -73,6 +69,7 @@ static int bg_schedboost_fd = -1; static int fg_schedboost_fd = -1; static int ta_schedboost_fd = -1; +#if defined(USE_CPUSETS) || defined(USE_SCHEDBOOST) /* Add tid to the scheduling group defined by the policy */ static int add_tid_to_cgroup(int tid, int fd) { @@ -107,30 +104,18 @@ static int add_tid_to_cgroup(int tid, int fd) return 0; } +#endif //defined(USE_CPUSETS) || defined(USE_SCHEDBOOST) static void __initialize(void) { - char* filename; if (!access("/dev/cpuctl/tasks", F_OK)) { __sys_supports_schedgroups = 1; - - filename = "/dev/cpuctl/tasks"; - fg_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC); - if (fg_cgroup_fd < 0) { - SLOGE("open of %s failed: %s\n", filename, strerror(errno)); - } - - filename = "/dev/cpuctl/bg_non_interactive/tasks"; - bg_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC); - if (bg_cgroup_fd < 0) { - SLOGE("open of %s failed: %s\n", filename, strerror(errno)); - } } else { __sys_supports_schedgroups = 0; } #ifdef USE_CPUSETS if (!access("/dev/cpuset/tasks", F_OK)) { - + char* filename; filename = "/dev/cpuset/foreground/tasks"; fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC); filename = "/dev/cpuset/background/tasks"; @@ -380,35 +365,24 @@ int set_sched_policy(int tid, SchedPolicy policy) #endif if (__sys_supports_schedgroups) { - int fd = -1; int boost_fd = -1; switch (policy) { case SP_BACKGROUND: - fd = bg_cgroup_fd; boost_fd = bg_schedboost_fd; break; case SP_FOREGROUND: case SP_AUDIO_APP: case SP_AUDIO_SYS: - fd = fg_cgroup_fd; boost_fd = fg_schedboost_fd; break; case SP_TOP_APP: - fd = fg_cgroup_fd; boost_fd = ta_schedboost_fd; break; default: - fd = -1; boost_fd = -1; break; } - - if (add_tid_to_cgroup(tid, fd) != 0) { - if (errno != ESRCH && errno != ENOENT) - return -errno; - } - #ifdef USE_SCHEDBOOST if (boost_fd > 0 && add_tid_to_cgroup(tid, boost_fd) != 0) { if (errno != ESRCH && errno != ENOENT) diff --git a/rootdir/init.rc b/rootdir/init.rc index df60f6582..7dc9e5509 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -145,15 +145,6 @@ on init write /dev/cpuctl/cpu.rt_period_us 1000000 write /dev/cpuctl/cpu.rt_runtime_us 950000 - mkdir /dev/cpuctl/bg_non_interactive - chown system system /dev/cpuctl/bg_non_interactive/tasks - chmod 0666 /dev/cpuctl/bg_non_interactive/tasks - # 5.0 % - write /dev/cpuctl/bg_non_interactive/cpu.shares 52 - write /dev/cpuctl/bg_non_interactive/cpu.rt_period_us 1000000 - # active FIFO threads will never be in BG - write /dev/cpuctl/bg_non_interactive/cpu.rt_runtime_us 10000 - # sets up initial cpusets for ActivityManager mkdir /dev/cpuset mount cpuset none /dev/cpuset |