[OnePlus 5 Guides, News, & Discussion] Ryther:
Hi [MENTION=5060769]Mostafa Wael[/MENTION] ! First thing first, thank you to bring these settings on our phone and the SD835 ecosystem.

Second, I want to point out a couple of problem (I think) of the FusionB script: I'm on xXx+flash kernel and I've ensured that the ROM installed without any AKT ticks, but the script doesn't kick in on start and doesn't even apply completely on a manual installation. After extracting the script to try and apply it manually, I've found that setting timer_slack to -1 is shown as 4294947296 in EXKM (I've set it to 0). The standard clock for the BIG cluster is checked against the 2457400 value, but echoing the maxfreq variable show 2457600 so the script think that the CPU can be overcloked while it is not. Last but not least I think this line

echo 1000 /proc/sys/kernel/sched_select_prev_cpu_us

should be

echo 1000 > /proc/sys/kernel/sched_select_prev_cpu_us

Dunno if I'm right or wrong, but these are my findings, hope I could be of any help (other than my subpar English XD )

Keep up the great work!

EDIT: this is the output of the script after tweaking what I've found above (the line starting with BC is the output of this command: echo BC Freq $maxfreq/2457600). There are 3 more errors but I don't think they matter

-----------------------------------------------
Applying FusionB (Balanced Profile)
Advanced Kernel Settings
-----------------------------------------------
Device: One Plus 5 & S835 Devices
Stable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Checking Android version...
Android Nougat 7.1.X detected!
N detected... Applying proper settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Applying settings to LITTLE Cluster...
No LITTLE Cluster Overclocking detected.
Applying appropriate values.
Applying settings to BIG Cluster
BC freq 2457600/2457600
No BIG Cluster Overclocking detected.
Applying appropriate values.
==========================================
Checking whether you are using a Sultanxda based ROM or not
==========================================
Checking ROM...
Applying appropriate values.
setting appropriate values for input boost
==========================================
Disabling TouchBoost
Disabling BCL and Removing Perfd
Disabling Aggressive CPU Thermal Throttling
Tweaking HMP Scheduler for correcting BIG Cluster utilization
==========================================
Tweaking other various Settings
·I/O Values
/storage/emulated/0/_FLASH/OTHER/FusionB[354]: cat: /sys/block/../devices/soc/624000.ufshc/host0/target0:0:0/0:0:0:[0-4]/block/*/queue/scheduler: No such file or directory
/storage/emulated/0/_FLASH/OTHER/FusionB[354]: can't create /sys/block/../devices/soc/624000.ufshc/host0/target0:0:0/0:0:0:[0-4]/block/*/queue/scheduler: No such file or directory
Changing block I/O scheduler

/storage/emulated/0/_FLASH/OTHER/FusionB[354]: cat: /sys/block/../devices/soc/624000.ufshc/host0/target0:0:0/0:0:0:[0-4]/block/*/queue/scheduler: No such file or directory
·Memory Values
·TCP Values
westwood reno cubic
------------------------------------------------------------
FusionB Successfully Applied!
You may now tweak them further
using EXKM or Kernel Adiutor
------------------------------------------------------------

Done, press ENTER then close

This is the modified script:

#!/system/bin/sh
#Interactive Governor tweaks for OnePlus 5.
#Fusion profiles are set for a balanced and performance use.
#FusionB, FusionP and Stock settings are present in this script.
#FusionB is tweaked in a way that Cluster 1 (small) uses mostly the frequencies from 300 to 1555 and when needed, Cluster 2(big) enters to help, using frequencies up to 1881 and jumping above that when extreme load is present.
#FusionP is still in development
#Stock are the stock settings from Stock kernel
#Scripts made by Senthil360 and Asiier and changed by patalao
#Credits for @Asiier [MENTION=5060769]Mostafa Wael[/MENTION]/@Senthil360
#TWEAKS_BEGIN
echo ""
echo -----------------------------------------------
echo Applying 'FusionB (Balanced Profile)'
echo Advanced Kernel Settings
echo -----------------------------------------------
sleep 0.5
echo "Device: One Plus 5 & S835 Devices"
echo Stable
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sleep 0.3
echo Checking Android version...
if grep -q 'ro.build.version.sdk=25' /system/build.prop; then
echo Android Nougat 7.1.X detected!
sleep 0.3
echo N detected... Applying proper settings
fi
if grep -q 'ro.build.version.sdk=24' /system/build.prop; then
echo Android Nougat 7.0.X detected!
sleep 0.3
echo N detected... Applying proper settings
fi
if grep -q 'ro.build.version.sdk=26' /system/build.prop; then
echo Android Oreo 8.0.0 detected!
sleep 0.3
echo O detected... Applying proper settings
fi
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sleep 0.3
#Apply settings to LITTLE cluster
echo Applying settings to LITTLE Cluster...
sleep 0.5
#Temporarily change permissions to governor files for the LITTLE cluster to enable Interactive governor
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo interactive > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
#Grab Maximum Achievable Frequency for the LITTLE Cluster
maxfreq=$(cat "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq")
if test $maxfreq -eq 1900800; then
#Temporarily change permissions to governor files for the Little cluster to set the maximum frequency to 1900MHz
echo No LITTLE Cluster Overclocking detected.
echo Applying appropriate values.
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 1900800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq #Core 0 Maximum Frequency = 1900MHz
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
echo 55 1248000:65 1401600:85 1670400:95 1824000:99 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
elif test $maxfreq -eq 2112000; then
#Temporarily change permissions to governor files for the Little cluster to set the maximum frequency to 2112MHz
echo LITTLE Cluster Overclocking detected.
echo Applying appropriate values.
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 2112000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq #Core 0 Maximum Frequency = 2112MHz
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
echo 55 1248000:65 1401600:85 1670400:95 1900800:99 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
maxfreq=$(cat "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq")
fi
if test $maxfreq -lt 1900800; then
#Temporarily change permissions to governor files for the Big cluster to set the maximum frequency to 1900MHz
echo LITTLE Cluster Underclocking detected!!
sleep 1
echo We recommend not to UnderClock the CPU as the tweaks already will take care of that If needed
echo The tweaks will continue getting applied but we recommend setting the CPU to Max frequency!
sleep 4
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
echo 55 1248000:65 1401600:85 1670400:95 1824000:99 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
elif test $maxfreq -gt 2112000; then
#Temporarily change permissions to governor files for the Little cluster to set the maximum frequency to 2112MHz
echo LITTLE Cluster Overclocking detected.
sleep 1
echo This OverClock is higher than normal and only possible on Xceed Kernel
echo The tweak will continue getting applyed
echo " Althought it might not reach the maximum frequency you have sett as it haven't been made to work with frecuencies higher than 2112 Mhz "
#chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
#echo 2112000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq #Core 0 Maximum Frequency = 2112MHz
#chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
echo 55 1248000:65 1401600:85 1670400:95 1824000:99 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
fi
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/*
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_slack
echo 1171200 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
echo 20000 1324800:40000 1555200:80000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/boost
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/fast_ramp_down
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/align_windows
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse_duration
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
if [ -e "/sys/devices/system/cpu/cpu0/cpufreq/interactive/enable_prediction" ]; then
chmod 644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/enable_prediction
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/enable_prediction
fi
sleep 0.5
#Apply settings to Big cluster
echo Applying settings to BIG Cluster
sleep 0.2
#Temporarily change permissions to governor files for the big cluster to enable Interactive governor
chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo interactive > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
chmod 444 /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
#Grab Maximum Achievable Frequency for the Big Cluster
maxftarget=2457600
maxfreq=$(cat "/sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_max_freq")
echo BC freq $maxfreq/$maxftarget
if test $maxfreq -eq $maxftarget; then
#Temporarily change permissions to governor files for the Big cluster to set the maximum frequency to 2457MHz
echo No BIG Cluster Overclocking detected.
echo Applying appropriate values.
chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
echo $maxftarget > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq #Core 2 Maximum Frequency = 2457MHz
chmod 444 /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
echo 65 1190400:75 1574400:90 1824000:98 2112000:100 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
chmod 444 /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
elif test $maxfreq -lt $maxftarget; then
#Temporarily change permissions to governor files for the Big cluster to set the maximum frequency to 2457MHz
echo BIG Cluster Underclocking detected!!
sleep 1
echo We recommend not to UnderClock the CPU as the tweaks already will take care of that If needed
echo The tweaks will continue getting applied but we recommend setting the CPU to Max frequency!
sleep 4
#chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
#echo $maxftarget > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq #Core 0 Maximum Frequency = 2457MHz
#chmod 444 /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
echo 65 1190400:75 1574400:90 1824000:98 2112000:100 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
chmod 444 /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
elif test $maxfreq -gt $maxftarget; then
#Temporarily change permissions to governor files for the Little cluster to set the maximum frequency to 2457MHz
echo BIG Cluster Overclocking detected.
sleep 1
echo This OverClock is higher than normal and only possible on Xceed Kernel
echo The tweak will continue getting applyed
echo " Althought it might no reach the maximum frequency you have set as it hasn't been made to work with frecuencies higher than 2457 Mhz "
sleep 4
#chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
#echo $maxftarget > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq #Core 0 Maximum Frequency = 2457MHz
#chmod 444 /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
echo 65 1190400:75 1574400:90 1824000:98 2112000:100 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
chmod 444 /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
fi
sleep 0.5
chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/interactive/*
#Tweak Interactive Governor
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_slack
echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
echo 40000 1420800:80000 1728000:150000 2035200:100000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
echo 80 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis
echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost
echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/fast_ramp_down
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/align_windows
echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/boostpulse_duration
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
if [ -e "/sys/devices/system/cpu/cpu4/cpufreq/interactive/enable_prediction" ]; then
chmod 644 /sys/devices/system/cpu/cpu4/cpufreq/interactive/enable_prediction
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/enable_prediction
fi
sleep 0.2
echo "=========================================="
echo Checking whether you are using a Sultanxda based ROM or not
echo "=========================================="
#Checking whether you are using a Sultanxda based ROM or not
echo Checking ROM...
sleep 0.2
echo Applying appropriate values.
if [ -e "/sys/kernel/cpu_input_boost/enabled" ]; then
echo Disabling Input Boost for the LITTLE cluster and for the BIG Cluster and custom thermal driver of Sultanxda
chmod 644 /sys/kernel/cpu_input_boost/enabled
echo 0 > /sys/kernel/cpu_input_boost/enabled
chmod 644 /sys/kernel/msm_thermal/enabled
echo 0 > /sys/kernel/msm_thermal/enabled
else
echo setting appropriate values for input boost
fi
if [ -e "/sys/module/cpu_boost/parameters/input_boost_freq" ]; then
chmod 644 /sys/module/cpu_boost/parameters/input_boost_freq
echo 0:672000 1:0 2:0 3:0 4:806400 5:0 6:0 7:0 > /sys/module/cpu_boost/parameters/input_boost_freq
chmod 644 /sys/module/cpu_boost/parameters/input_boost_ms
echo 100 > /sys/module/cpu_boost/parameters/input_boost_ms
else
echo "*Input Boost is not avalible for your Kernel*"
fi
sleep 0.3
echo "=========================================="
#Disable TouchBoost
echo Disabling TouchBoost
if [ -e "/sys/module/msm_performance/parameters/touchboost" ]; then
chmod 644 /sys/module/msm_performance/parameters/touchboost
echo 0 > /sys/module/msm_performance/parameters/touchboost
else
echo "*Not supported for your current Kernel*"
fi
#Disable BCL
echo Disabling BCL and Removing Perfd
if [ -e "/sys/devices/soc/soc:qcom,bcl/mode" ]; then
echo -n disable > /sys/devices/soc/soc:qcom,bcl/mode
fi
#Enable Core Control and Disable MSM Thermal Throttling allowing for longer sustained performance
echo Disabling Aggressive CPU Thermal Throttling
if [ -e "/sys/module/msm_thermal/core_control/enabled" ]; then
echo 1 > /sys/module/msm_thermal/core_control/enabled
fi
if [ -e "/sys/module/msm_thermal/parameters/enabled" ]; then
echo N > /sys/module/msm_thermal/parameters/enabled
fi
#Tweak HMP Scheduler to feed the Big cluster more tasks
sleep 0.3
echo Tweaking HMP Scheduler for correcting BIG Cluster utilization
echo 2 > /proc/sys/kernel/sched_window_stats_policy
echo 75 > /proc/sys/kernel/sched_downmigrate
echo 85 > /proc/sys/kernel/sched_upmigrate
echo 9 > /proc/sys/kernel/sched_spill_nr_run
echo 100 > /proc/sys/kernel/sched_spill_load
echo 30 > /proc/sys/kernel/sched_init_task_load
if [ -e "/proc/sys/kernel/sched_heavy_task" ]; then
echo 0 > /proc/sys/kernel/sched_heavy_task
fi
if [ -e "/proc/sys/kernel/sched_enable_power_aware" ]; then
echo 1 > /proc/sys/kernel/sched_enable_power_aware
fi
echo 5 > /proc/sys/kernel/sched_ravg_hist_size
if [ -e "/proc/sys/kernel/sched_small_wakee_task_load" ]; then
echo 5 > /proc/sys/kernel/sched_small_wakee_task_load
fi
if [ -e "/proc/sys/kernel/sched_wakeup_load_threshold" ]; then
echo 110 > /proc/sys/kernel/sched_wakeup_load_threshold
fi
if [ -e "/proc/sys/kernel/sched_small_task" ]; then
echo 15 > /proc/sys/kernel/sched_small_task
fi
if [ -e "/proc/sys/kernel/sched_big_waker_task_load" ]; then
echo 35 > /proc/sys/kernel/sched_big_waker_task_load
fi
if [ -e "/proc/sys/kernel/perf_cpu_time_max_percent" ]; then
echo 15 > /proc/sys/kernel/perf_cpu_time_max_percent
fi
if [ -e "/proc/sys/kernel/sched_select_prev_cpu_us" ]; then
echo 1000 > /proc/sys/kernel/sched_select_prev_cpu_us
fi
if [ -e "/proc/sys/kernel/sched_restrict_cluster_spill" ]; then
echo 0 > /proc/sys/kernel/sched_restrict_cluster_spill
fi
echo 950000 > /proc/sys/kernel/sched_rt_runtime_us
echo 1000000 > /proc/sys/kernel/sched_rt_period_us
#echo 1 > /proc/sys/kernel/sched_migration_fixup
if [ -e "/proc/sys/kernel/sched_freq_dec_notify" ]; then
echo 410000 > /proc/sys/kernel/sched_freq_dec_notify
fi
if [ -e "/proc/sys/kernel/sched_freq_inc_notify" ]; then
echo 410000 > /proc/sys/kernel/sched_freq_inc_notify
fi
if [ -e "/proc/sys/kernel/sched_boost" ]; then
echo 0 > /proc/sys/kernel/sched_boost
fi
#Tweaks for other various Settings
sleep 0.5
echo "=========================================="
echo Tweaking other various Settings
echo ·I/O Values
if [ -d /sys/block/dm-0 ] || [ -d /sys/devices/virtual/block/dm-0 ]; then
if [ -e /sys/devices/virtual/block/dm-0/queue/scheduler ]; then
DM_PATH=/sys/devices/virtual/block/dm-0/queue
fi
if [ -e /sys/block/dm-0/queue/scheduler ]; then
DM_PATH=/sys/block/dm-0/queue
fi
string=/sys/devices/virtual/block/dm-0/queue/scheduler;
Zen_Available=false;
if $BB grep 'fiops' $string; then
Zen_Available=true;
fi
if [ "$Zen_Available" == "true" ]; then
if [ -e $DM_PATH/scheduler_hard ]; then
echo fiops > $DM_PATH/scheduler_hard
fi
echo fiops > $DM_PATH/scheduler
sleep 2
echo 300 > $DM_PATH/iosched/sync_expire
echo 3000 > $DM_PATH/iosched/async_expire
echo 10 > $DM_PATH/iosched/fifo_batch
chmod 644 $DM_PATH/iosched/sync_expire
echo 400 > $DM_PATH/iosched/sync_expire
fi
if [ "$Zen_Available" = "false" ]; then
if grep -q 'ro.build.flavor=lineage_oneplus3-userdebug' /system/build.prop; then
echo ZEN not avalible, setting 'Noop' instead...
if [ -e $DM_PATH/scheduler_hard ]; then
echo noop > $DM_PATH/scheduler_hard
fi
echo noop > $DM_PATH/scheduler
else
echo ZEN not avalible, setting 'CFQ' instead...
if [ -e $DM_PATH/scheduler_hard ]; then
echo cfq > $DM_PATH/scheduler_hard
fi
echo cfq > $DM_PATH/scheduler
fi
fi
fi
for i in /sys/block/../devices/soc/624000.ufshc/host0/target0:0:0/0:0:0:[0-4]/block/*/queue; do
string4=$($BB readlink -f $i/scheduler | cut -d 'q' -f1 | cut -d 'k' -f2 | cut -d '/' -f2 | tr a-z A-Z)
string5=$($BB cat $i/scheduler | cut -d ']' -f1 | cut -d '[' -f2 | $BB tr a-z A-Z)
if [ "$string5" == "NOOP" ]; then
echo "Leaving $string4 block at default $string5"
echo ""
sleep 0.1
fi
if [ "$string5" != "NOOP" ]; then
echo "Changing $string4 block I/O scheduler"
if [ -e $i/scheduler_hard ]; then
echo fiops > $i/scheduler_hard
fi
echo fiops > $i/scheduler
echo ""
sleep 2
# Initialize string 6 to avoid reference conflicts
string6=$($BB cat $i/scheduler | cut -d ']' -f1 | cut -d '[' -f2)
if [ "$string6" == "zen" ]; then
echo 300 > $i/iosched/sync_expire
echo 3000 > $i/iosched/async_expire
echo 10 > $i/iosched/fifo_batch
chmod 644 $i/iosched/sync_expire
echo 400 > $i/iosched/sync_expire
fi
fi
done
if [ -e "$DM_PATH/iostats" ]; then
echo 0 > $DM_PATH/iostats
fi
if [ -e "$DM_PATH/rq_affinity" ]; then
echo 1 > $DM_PATH/rq_affinity
fi
if [ -e "/sys/block/dm-0/bdi/read_ahead_kb" ]; then
echo 512 > /sys/devices/virtual/block/dm-0/bdi/read_ahead_kb
fi
if [ -e "/sys/block/sda/bdi/read_ahead_kb" ]; then
echo 512 > /sys/block/sda/bdi/read_ahead_kb
fi
echo ·Memory Values
echo 0 > /proc/sys/vm/swappiness
echo 100 > /proc/sys/vm/vfs_cache_pressure
echo 40 > /proc/sys/vm/dirty_ratio
echo 10 > /proc/sys/vm/dirty_background_ratio
echo 4096 > /proc/sys/vm/min_free_kbytes
echo 100 > /proc/sys/vm/dirty_expire_centisecs
echo 250 > /proc/sys/vm/dirty_writeback_centisecs
echo 0 > /proc/sys/vm/oom_kill_allocating_task
echo 3 > /proc/sys/vm/page-cluster
echo 64 > /proc/sys/kernel/random/read_wakeup_threshold
echo 128 > /proc/sys/kernel/random/write_wakeup_threshold
if [ -e "/sys/module/lowmemorykiller/parameters/enable_adaptive_lmk" ]; then
chmod 666 /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
chown root /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
echo 0 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
fi
if [ -e "/sys/module/lowmemorykiller/parameters/enable_adaptive_lmk" ]; then
echo 0 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
else
echo ' *Adaptive LMK is not present on your Kernel* '
fi
if [ -e "/sys/module/lowmemorykiller/parameters/minfree" ]; then
echo 23939,44091,58788,73485,88182,102879 > /sys/module/lowmemorykiller/parameters/minfree
else
echo ' *LMK cannot currently be modified on your Kernel* '
fi
echo ·TCP Values
string2=/proc/sys/net/ipv4/tcp_available_congestion_control
if grep 'westwood' $string2; then
echo westwood > /proc/sys/net/ipv4/tcp_congestion_control
else
echo Westwood not avilable, using Cubic
echo cubic > /proc/sys/net/ipv4/tcp_congestion_control
fi
sleep 1
echo ------------------------------------------------------------
echo 'FusionB' Successfully Applied!
echo "Fusion Balanced" > /data/system/current_profile
echo You may now tweak them further
echo using EXKM or Kernel Adiutor
echo ------------------------------------------------------------
echo ""
echo " Done, press ENTER then close"
sleep 4

#################################################
#Modded by patalao
#Ported by Mostafa Wael
#Please say thanks and give proper credits if you're using this profile.
#Credits
#*soniCron *Alcolawl *RogerF81 *Asiier *Mostafa Wael *Senthil360 and all of those that have share their profiles on Nexus 5X/6P Advanced Interactive Tweaks respective threads.