Skip to content

Commit

Permalink
DEV 20200331
Browse files Browse the repository at this point in the history
配置生成:EAS默认使用动态conservative调速器,改进大量弹幕场景的流畅度,视效果是否保留
wipe-v2:修复HMP仿真阈值设置bug
uperf:更换监控surfaceflinger方法,修复崩溃
配置生成:系统关键进程不做CPU核心的限制,在拥挤的时候不受限制上大核,但是受stune调控默认上大核还是小核
once:不改动Samsung EPIC和ems,可能是睡死的原因
magisk模块:增加屏蔽power-libperfmgr配置文件

Signed-off-by: Matt Yang <yccy@outlook.com>
  • Loading branch information
yc9559 committed Mar 31, 2020
1 parent 6835b4c commit 0d7dd3f
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 27 deletions.
2 changes: 1 addition & 1 deletion magisk/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ print_modname()
on_install()
{
ui_print "- Extracting module files"
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH > /dev/null
# use universal setup.sh
sh $MODPATH/setup_uperf.sh
[ "$?" != "0" ] && abort
Expand Down
2 changes: 1 addition & 1 deletion magisk/module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=uperf
name=Uperf
version=v1 preview(20200329)
version=DEV 20200331
versionCode=1
author=Matt Yang
description=Userspace performance controller for android. Repo: https://github.com/yc9559/uperf/
Expand Down
16 changes: 15 additions & 1 deletion magisk/script/libcommon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Basic Tool Library
# https://github.com/yc9559/
# Author: Matt Yang
# Version: 20200227
# Version: 20200331

BASEDIR="$(dirname "$0")"
. $BASEDIR/pathinfo.sh
Expand Down Expand Up @@ -100,6 +100,20 @@ change_task_cgroup()
done
}

# $1:process_name $2:cgroup_name $3:"cpuset"/"stune"
change_proc_cgroup()
{
# avoid matching grep itself
# ps -Ao pid,args | grep kswapd
# 150 [kswapd0]
# 16490 grep kswapd
local ps_ret
ps_ret="$(ps -Ao pid,args)"
for temp_pid in $(echo "$ps_ret" | grep "$1" | awk '{print $1}'); do
echo $temp_pid > "/dev/$3/$2/cgroup.procs"
done
}

# $1:task_name $2:hex_mask(0x00000003 is CPU0 and CPU1)
change_task_affinity()
{
Expand Down
11 changes: 10 additions & 1 deletion magisk/script/libpowercfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Powercfg Library
# https://github.com/yc9559/
# Author: Matt Yang
# Version: 20200329
# Version: 20200330

BASEDIR="$(dirname "$0")"
. $BASEDIR/pathinfo.sh
Expand Down Expand Up @@ -46,6 +46,15 @@ get_package_name_by_keyword()
echo "$(pm list package | grep "$1" | head -n "$2" | cut -d: -f2)"
}

is_eas()
{
if [ "$(grep sched $CPU/cpu0/cpufreq/scaling_available_governors)" != "" ]; then
echo "true"
else
echo "false"
fi
}

# $1:"0:576000 4:710400 7:825600"
set_cpufreq_min()
{
Expand Down
2 changes: 1 addition & 1 deletion magisk/script/powercfg_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ save_panel()
write_panel ""
write_panel "Uperf https://github.com/yc9559/uperf/"
write_panel "Author: Matt Yang"
write_panel "Version: v1 preview(20200329)"
write_panel "Version: DEV 20200331"
write_panel "Last performed: $(date '+%Y-%m-%d %H:%M:%S')"
write_panel ""
write_panel "[Uperf status]"
Expand Down
47 changes: 31 additions & 16 deletions magisk/script/powercfg_once.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ change_task_cgroup "surfaceflinger" "foreground" "stune"
# reduce big cluster wakeup, eg. android.hardware.sensors@1.0-service
change_task_cgroup ".hardware." "background" "cpuset"
change_task_affinity ".hardware." "0f"
# ...but exclude the fingerprint&camera service for speed
# ...but exclude fingerprint&camera&display service for speed
change_task_cgroup ".hardware.biometrics.fingerprint" "" "cpuset"
change_task_cgroup ".hardware.camera.provider" "" "cpuset"
change_task_cgroup ".hardware.display" "" "cpuset"
change_task_affinity ".hardware.biometrics.fingerprint" "ff"
change_task_affinity ".hardware.camera.provider" "ff"
change_task_affinity ".hardware.display" "ff"

# provide best performance for fingerprint service
change_task_cgroup ".hardware.biometrics.fingerprint" "rt" "stune"
Expand All @@ -85,14 +87,20 @@ lock_val "0" /sys/class/input_booster/level
lock_val "0" /sys/class/input_booster/head
lock_val "0" /sys/class/input_booster/tail
# Samsung EPIC interfaces
lock_val "0" /dev/cluster0_freq_min
lock_val "0" /dev/cluster1_freq_min
lock_val "0" /dev/cluster2_freq_min
# lock_val "0" /dev/cluster0_freq_min
# lock_val "0" /dev/cluster1_freq_min
# lock_val "0" /dev/cluster2_freq_min
# lock_val "0" /dev/bus_throughput
# lock_val "0" /dev/gpu_freq_min
# Samsung /kernel/sched/ems/...
lock_val "0" /sys/kernel/ems/eff_mode
# lock_val "0" /sys/kernel/ems/eff_mode
# 3rd
lock_val "0" /sys/kernel/cpu_input_boost/enabled
lock_val "0" /sys/kernel/cpu_input_boost/ib_freqs
lock_val "0" /sys/kernel/cpu_input_boost/ib_duration_m
lock_val "0" /sys/kernel/cpu_input_boost/ib_duration_ms
lock_val "0" /sys/module/cpu_boost/parameters/input_boost_enabled
lock_val "0" /sys/module/cpu_boost/parameters/dynamic_stune_boost
lock_val "0" /sys/module/cpu_boost/parameters/input_boost_ms
lock_val "0" /sys/module/cpu_boost/parameters/input_boost_ms_s2
lock_val "0" /sys/module/dsboost/parameters/input_boost_duration
Expand All @@ -119,6 +127,8 @@ lock_val "0" /sys/module/devfreq_boost/parameters/input_boost_duration

# stop qualcomm perfd
perfhal_stop
# brain service maybe not smart
stop oneplus_brain_service
# disable service below will BOOM
# stop vendor.power.stats-hal-1-0
# stop vendor.power-hal-1-0
Expand All @@ -133,24 +143,29 @@ lock_val "0" $CPU/cpuhotplug/enabled
for i in 0 1 2 3 4 5 6 7 8 9; do
lock_val "1" $CPU/cpu$i/online
done

# no msm_performance limit
set_cpufreq_min "0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0"
set_cpufreq_max "0:9999000 1:9999000 2:9999000 3:9999000 4:9999000 5:9999000 6:9999000 7:9999000"
# more conservative governor
set_governor_param "schedutil/hispeed_load" "0:90 4:90 6:90 7:90"
set_governor_param "schedutil/hispeed_freq" "0:1200000 4:1200000 6:1200000 7:1200000"
# unify walt hmp interactive governor
set_governor_param "interactive/use_sched_load" "0:1 4:1 6:1 7:1"
set_governor_param "interactive/use_migration_notif" "0:1 4:1 6:1 7:1"
set_governor_param "interactive/enable_prediction" "0:0 4:0 6:0 7:0"
set_governor_param "interactive/ignore_hispeed_on_notif" "0:0 4:0 6:0 7:0"
set_governor_param "interactive/fast_ramp_down" "0:0 4:0 6:0 7:0"
# conservative sched core_ctl
set_corectl_param "enable" "0:1 2:1 4:1 6:1 7:1"
set_corectl_param "busy_down_thres" "0:10 2:10 4:10 6:10 7:10"
set_corectl_param "busy_up_thres" "0:20 2:20 4:20 6:20 7:20"
set_corectl_param "offline_delay_ms" "0:100 2:100 4:100 6:100 7:100"

# unify governor
if [ "$(is_eas)" == "true" ]; then
set_governor_param "scaling_governor" "0:conservative 2:conservative 4:conservative 6:conservative 7:conservative"
else
set_governor_param "scaling_governor" "0:interactive 2:interactive 4:interactive 6:interactive 7:interactive"
fi
# unify walt hmp interactive governor
set_governor_param "interactive/use_sched_load" "0:1 2:1 4:1 6:1 7:1"
set_governor_param "interactive/use_migration_notif" "0:1 2:1 4:1 6:1 7:1"
set_governor_param "interactive/enable_prediction" "0:0 2:0 4:0 6:0 7:0"
set_governor_param "interactive/ignore_hispeed_on_notif" "0:0 2:0 4:0 6:0 7:0"
set_governor_param "interactive/fast_ramp_down" "0:0 2:0 4:0 6:0 7:0"

# disable sched global placement boost
lock_val "0" $SCHED/sched_boost
lock_val "0" $SCHED/sched_walt_rotate_big_tasks
Expand All @@ -161,8 +176,8 @@ lock_val "0" $SCHED/sched_boost_top_app
# unify WALT HMP sched
lock_val "5" $SCHED/sched_ravg_hist_size
lock_val "2" $SCHED/sched_window_stats_policy
# do not place light processes on big cluster
set_sched_migrate "95 80" "80 60" "140" "120"
# place a little heavier processes on big cluster, due to Cortex-A55 poor efficiency
set_sched_migrate "60 90" "30 30" "120" "100"
# prefer to use prev cpu, decrease jitter from 0.5ms to 0.3ms with lpm settings
lock_val "30000000" $SCHED/sched_migration_cost_ns
# OnePlus opchain pins UX threads on the big cluster
Expand Down
18 changes: 12 additions & 6 deletions magisk/setup_uperf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,17 @@ _get_sm6150_type()

_get_sdm865_type()
{
local ddr_device_type
ddr_device_type="$(od -An -tx /proc/device-tree/memory/ddr_device_type)"
ddr_device_type="${ddr_device_type:4:2}"
[ "$ddr_device_type" == "07" ] && echo "sdm865_lp4x"
[ "$ddr_device_type" == "08" ] && echo "sdm865_lp5"
local ddr_type4="07"
local ddr_type5="08"
local ddr_type
ddr_type="$(od -An -tx /proc/device-tree/memory/ddr_device_type)"
if [ ${ddr_type:4:2} == $ddr_type5 ]; then
echo "sdm865_lp5"
elif [ ${ddr_type:4:2} == $ddr_type4 ]; then
echo "sdm865_lp4x"
else
echo "sdm865_lp5"
fi
}

_get_sdm660_type()
Expand Down Expand Up @@ -143,7 +149,7 @@ uperf_print_banner()
echo ""
echo "* Uperf https://github.com/yc9559/uperf/"
echo "* Author: Matt Yang"
echo "* Version: v1 preview(20200329)"
echo "* Version: DEV 20200331"
echo ""
}

Expand Down
1 change: 1 addition & 0 deletions magisk/system/vendor/etc/powerhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit 0d7dd3f

Please sign in to comment.