diff options
| -rw-r--r-- | debuggerd/elf_utils.cpp | 8 | ||||
| -rw-r--r-- | libcutils/Android.mk | 6 | ||||
| -rw-r--r-- | libcutils/sched_policy.c | 18 | ||||
| -rw-r--r-- | rootdir/init.rc | 15 | ||||
| -rw-r--r-- | rootdir/init.zygote32.rc | 2 | ||||
| -rw-r--r-- | rootdir/init.zygote32_64.rc | 4 | ||||
| -rw-r--r-- | rootdir/init.zygote64.rc | 2 | ||||
| -rw-r--r-- | rootdir/init.zygote64_32.rc | 4 | ||||
| -rw-r--r-- | sdcard/sdcard.c | 17 |
9 files changed, 64 insertions, 12 deletions
diff --git a/debuggerd/elf_utils.cpp b/debuggerd/elf_utils.cpp index 3f0dbde35..9959f2e1f 100644 --- a/debuggerd/elf_utils.cpp +++ b/debuggerd/elf_utils.cpp @@ -63,10 +63,10 @@ static bool get_build_id( if (nhdr.n_type == NT_GNU_BUILD_ID) { // Skip the name (which is the owner and should be "GNU"). addr += NOTE_ALIGN(nhdr.n_namesz); - uint8_t build_id_data[128]; - if (nhdr.n_namesz > sizeof(build_id_data)) { - ALOGE("Possible corrupted note, name size value is too large: %u", - nhdr.n_namesz); + uint8_t build_id_data[160]; + if (nhdr.n_descsz > sizeof(build_id_data)) { + ALOGE("Possible corrupted note, desc size value is too large: %u", + nhdr.n_descsz); return false; } if (backtrace->Read(addr, build_id_data, nhdr.n_descsz) != nhdr.n_descsz) { diff --git a/libcutils/Android.mk b/libcutils/Android.mk index 51c6d9d1f..c0d4d76cf 100644 --- a/libcutils/Android.mk +++ b/libcutils/Android.mk @@ -121,6 +121,9 @@ LOCAL_STATIC_LIBRARIES := liblog ifneq ($(ENABLE_CPUSETS),) LOCAL_CFLAGS += -DUSE_CPUSETS endif +ifneq ($(ENABLE_SCHEDBOOST),) +LOCAL_CFLAGS += -DUSE_SCHEDBOOST +endif LOCAL_CFLAGS += -Werror -Wall -Wextra -std=gnu90 LOCAL_CLANG := true LOCAL_SANITIZE := integer @@ -135,6 +138,9 @@ LOCAL_SHARED_LIBRARIES := liblog ifneq ($(ENABLE_CPUSETS),) LOCAL_CFLAGS += -DUSE_CPUSETS endif +ifneq ($(ENABLE_SCHEDBOOST),) +LOCAL_CFLAGS += -DUSE_SCHEDBOOST +endif LOCAL_CFLAGS += -Werror -Wall -Wextra LOCAL_C_INCLUDES := $(libcutils_c_includes) LOCAL_CLANG := true diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c index 298e3dac7..6bba3a7b1 100644 --- a/libcutils/sched_policy.c +++ b/libcutils/sched_policy.c @@ -64,6 +64,8 @@ static int fg_cgroup_fd = -1; // File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error static int bg_cpuset_fd = -1; static int fg_cpuset_fd = -1; +static int bg_schedboost_fd = -1; +static int fg_schedboost_fd = -1; #endif /* Add tid to the scheduling group defined by the policy */ @@ -128,6 +130,12 @@ static void __initialize(void) { fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC); filename = "/dev/cpuset/background/tasks"; bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC); +#ifdef USE_SCHEDBOOST + filename = "/sys/fs/cgroup/stune/foreground/tasks"; + fg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC); + filename = "/sys/fs/cgroup/stune/tasks"; + bg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC); +#endif } #endif @@ -253,17 +261,20 @@ int set_cpuset_policy(int tid, SchedPolicy policy) pthread_once(&the_once, __initialize); int fd; + int boost_fd; switch (policy) { case SP_BACKGROUND: fd = bg_cpuset_fd; + boost_fd = bg_schedboost_fd; break; case SP_FOREGROUND: case SP_AUDIO_APP: case SP_AUDIO_SYS: fd = fg_cpuset_fd; + boost_fd = fg_schedboost_fd; break; default: - fd = -1; + boost_fd = fd = -1; break; } @@ -272,6 +283,11 @@ int set_cpuset_policy(int tid, SchedPolicy policy) return -errno; } + if (boost_fd > 0 && add_tid_to_cgroup(tid, boost_fd) != 0) { + if (errno != ESRCH && errno != ENOENT) + return -errno; + } + return 0; #endif } diff --git a/rootdir/init.rc b/rootdir/init.rc index 1f63fcf74..8ce476071 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -56,6 +56,17 @@ on init chown root system /sys/fs/cgroup/memory/sw/tasks chmod 0660 /sys/fs/cgroup/memory/sw/tasks + # Create energy-aware scheduler tuning nodes + mkdir /sys/fs/cgroup/stune + mount cgroup none /sys/fs/cgroup/stune schedtune + mkdir /sys/fs/cgroup/stune/foreground + chown system system /sys/fs/cgroup/stune + chown system system /sys/fs/cgroup/stune/foreground + chown system system /sys/fs/cgroup/stune/tasks + chown system system /sys/fs/cgroup/stune/foreground/tasks + chmod 0664 /sys/fs/cgroup/stune/tasks + chmod 0664 /sys/fs/cgroup/stune/foreground/tasks + # Mount staging areas for devices managed by vold # See storage config details at http://source.android.com/tech/storage/ mount tmpfs tmpfs /mnt mode=0755,uid=0,gid=1000 @@ -71,7 +82,6 @@ on init mkdir /mnt/expand 0771 system system # Storage views to support runtime permissions - mkdir /storage 0755 root root mkdir /mnt/runtime 0700 root root mkdir /mnt/runtime/default 0755 root root mkdir /mnt/runtime/default/self 0755 root root @@ -167,13 +177,16 @@ on init chown system system /dev/cpuset/foreground chown system system /dev/cpuset/foreground/boost chown system system /dev/cpuset/background + chown system system /dev/cpuset/system-background chown system system /dev/cpuset/tasks chown system system /dev/cpuset/foreground/tasks chown system system /dev/cpuset/foreground/boost/tasks chown system system /dev/cpuset/background/tasks + chown system system /dev/cpuset/system-background/tasks chmod 0664 /dev/cpuset/foreground/tasks chmod 0664 /dev/cpuset/foreground/boost/tasks chmod 0664 /dev/cpuset/background/tasks + chmod 0664 /dev/cpuset/system-background/tasks chmod 0664 /dev/cpuset/tasks diff --git a/rootdir/init.zygote32.rc b/rootdir/init.zygote32.rc index ff25ac227..0ca38b9cd 100644 --- a/rootdir/init.zygote32.rc +++ b/rootdir/init.zygote32.rc @@ -5,4 +5,4 @@ service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-sys onrestart write /sys/power/state on onrestart restart media onrestart restart netd - writepid /dev/cpuset/foreground/tasks + writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks diff --git a/rootdir/init.zygote32_64.rc b/rootdir/init.zygote32_64.rc index 29bb1cf2e..1646c0f7e 100644 --- a/rootdir/init.zygote32_64.rc +++ b/rootdir/init.zygote32_64.rc @@ -5,10 +5,10 @@ service zygote /system/bin/app_process32 -Xzygote /system/bin --zygote --start-s onrestart write /sys/power/state on onrestart restart media onrestart restart netd - writepid /dev/cpuset/foreground/tasks + writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks service zygote_secondary /system/bin/app_process64 -Xzygote /system/bin --zygote --socket-name=zygote_secondary class main socket zygote_secondary stream 660 root system onrestart restart zygote - writepid /dev/cpuset/foreground/tasks
\ No newline at end of file + writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks diff --git a/rootdir/init.zygote64.rc b/rootdir/init.zygote64.rc index 5497524e4..b477c8ef2 100644 --- a/rootdir/init.zygote64.rc +++ b/rootdir/init.zygote64.rc @@ -5,4 +5,4 @@ service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-s onrestart write /sys/power/state on onrestart restart media onrestart restart netd - writepid /dev/cpuset/foreground/tasks + writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks diff --git a/rootdir/init.zygote64_32.rc b/rootdir/init.zygote64_32.rc index 8ed5e9ee8..633a98108 100644 --- a/rootdir/init.zygote64_32.rc +++ b/rootdir/init.zygote64_32.rc @@ -5,10 +5,10 @@ service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-s onrestart write /sys/power/state on onrestart restart media onrestart restart netd - writepid /dev/cpuset/foreground/tasks + writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks service zygote_secondary /system/bin/app_process32 -Xzygote /system/bin --zygote --socket-name=zygote_secondary class main socket zygote_secondary stream 660 root system onrestart restart zygote - writepid /dev/cpuset/foreground/tasks
\ No newline at end of file + writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c index 45efe369e..f86256195 100644 --- a/sdcard/sdcard.c +++ b/sdcard/sdcard.c @@ -1214,7 +1214,13 @@ static int handle_open(struct fuse* fuse, struct fuse_handler* handler, } out.fh = ptr_to_id(h); out.open_flags = 0; + +#ifdef FUSE_STACKED_IO + out.lower_fd = h->fd; +#else out.padding = 0; +#endif + fuse_reply(fuse, hdr->unique, &out, sizeof(out)); return NO_STATUS; } @@ -1378,7 +1384,13 @@ static int handle_opendir(struct fuse* fuse, struct fuse_handler* handler, } out.fh = ptr_to_id(h); out.open_flags = 0; + +#ifdef FUSE_STACKED_IO + out.lower_fd = -1; +#else out.padding = 0; +#endif + fuse_reply(fuse, hdr->unique, &out, sizeof(out)); return NO_STATUS; } @@ -1460,6 +1472,11 @@ static int handle_init(struct fuse* fuse, struct fuse_handler* handler, out.major = FUSE_KERNEL_VERSION; out.max_readahead = req->max_readahead; out.flags = FUSE_ATOMIC_O_TRUNC | FUSE_BIG_WRITES; + +#ifdef FUSE_STACKED_IO + out.flags |= FUSE_STACKED_IO; +#endif + out.max_background = 32; out.congestion_threshold = 32; out.max_write = MAX_WRITE; |
