[Redmi Note 2 General] vetefan:
I simplified the script and modified some values of interactive to have smoother performance.

The only problem now is that there is some delay for the phone to screen on when there's income calls, but for my daily use I seldom receive phone calls. You may set the frequency at screen off to be higher if you want faster phone call response.

I add also the function to switch off wifi and mobile data when screen off. To prevent the interference from cm settings, I used the files /sdcard/sysperf/sys.perf.profile and /sdcard/sysperf/sys.perf.autodata instead to control the behaviour. You can set with terminal emulator or text editor.

#!/system/bin/sh
#Custom CPU Profiles
#Modified by Vetefan for Redmi Note 2 CM 12.1

##################################################################################
################################Start of options##################################
##################################################################################

###################AWAKE GOVERNORS####################
AWAKE_GOVERNOR="interactive"
AWAKE_POWERSAVE_GOVERNOR="interactive"
AWAKE_HYPER_GOVERNOR="ondemand"

###################AWAKE PARAMETERS###################
AWAKE_FREQ="2158000"
AWAKE_POWERSAVE_FREQ="1326000"
AWAKE_HYPER_FREQ="2158000"

###################INTERACTIVE PARAMETERS###################
HISPEED_FREQ="806000" # 1183000 default
GO_HISPEED_LOAD="85" # 99 default
TARGET_LOADS="90 403000:75 806000:81 1183000:84 1326000:87 1482000:90 1664000:93 1885000:96 2158000:99" # 90 default
TIMER_RATE="40000" #20000 default
MIN_SAMPLE_TIME="10000" #20000 default
ABOVE_HIGHSPEED_DELAY="15000 1326000:20000 1482000:30000" #20000 default
TIMER_SLACK="10000" #20000 default

###################SLEEP GOVERNORS####################
SLEEP_GOVERNOR="powersave"

###################SLEEP PARAMETERS####################
SLEEP_FREQ="403000"

##################PAUSE VARIABLES###################
ALREADY_AWAKE=0
ALREADY_SLEEP=0
SYS_PERF_PROFILE_CURRENT=99
ORI_WIFI_STATE=0
ORI_DATA_STATE=0

##################################################################################
#################################End of options###################################
##################################################################################

##################NORMAL TWEAKS###################
# Tweak IO Scheduler
echo deadline > /sys/block/mmcblk0/queue/scheduler # cfq default. choices: cfq deadline noop
# echo 0 > /sys/block/mmcblk0/queue/iosched/slice_idle # only required if cfq or bfq chosen above
echo 256 > /sys/block/mmcblk0/queue/read_ahead_kb # 128 default. choose from 128, 256, 512, 1024, 2048
#Tweak VM
echo 300 > /proc/sys/vm/dirty_expire_centisecs # 200 default. Do not exceed 500 (5 seconds)
echo 500 > /proc/sys/vm/dirty_writeback_centisecs # 300 default. Do not exceed 500 (5 seconds)
#Tweak Entropy
echo 512 > /proc/sys/kernel/random/read_wakeup_threshold #64 default. choose from: 64, 128, 256, 512, 1024, 2048
echo 1024 > /proc/sys/kernel/random/write_wakeup_threshold #128 default. choose from: 128, 256,512, 1024, 2048, 4096
#Tweak for wifi router connection issues
echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6
#Turn off touchboost
echo 0 > /proc/cpufreq/cpufreq_limited_by_hevc
chmod 0400 /proc/cpufreq/cpufreq_limited_by_hevc
#Auto Data on off start, set to 0 if you do not want auto data on/off start at boot.
#setprop sys.perf.autodata 1
svc data disable
svc wifi disable
##################################################

#Infinite while loop to make sure correct governor, scheduler, and frequencies always applied
while [ 1 ]
do

##################################################################################
#####Main Loop: Function to set scheduler, governor, and frequencies based on variables######
##################################################################################
set_cpu_freq() {
if [ $ALREADY_AWAKE = 0 ]; then
AWAKE=`cat /sys/power/wait_for_fb_wake`

if [ $AWAKE = "awake" ]; then
awake_freq
fi;
AWAKE=;
fi;

sleep 1

if [ $ALREADY_SLEEP = 0 ]; then
SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ $SLEEPING = "sleeping" ]; then
sleep_loop
fi;
SLEEPING=;
fi;
}

##################################################################################
###############Function to Set Awake and Over Battery Limit Profile###############
##################################################################################
awake_freq() {

if [ -f /sdcard/sysperf/sys.perf.profile ]; then
SYS_PERF_PROFILE=`cat /sdcard/sysperf/sys.perf.profile`
else
SYS_PERF_PROFILE=1
fi;
interactive_tweak() {
echo $HISPEED_FREQ > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo $GO_HISPEED_LOAD > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo $TARGET_LOADS > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo $TIMER_RATE > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
echo $MIN_SAMPLE_TIME > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo $ABOVE_HIGHSPEED_DELAY > /sys/devices/system/cpu/cpufreq/interactive/above_highspeed_delay
echo $TIMER_SLACK > /sys/devices/system/cpu/cpufreq/interactive/timer_slack
}

if [ $SYS_PERF_PROFILE -ne $SYS_PERF_PROFILE_CURRENT ]; then
case $SYS_PERF_PROFILE in
0)	#POWERSAVE
echo "1" > /proc/hps/enabled
echo 2 > /proc/hps/num_limit_low_battery
echo 2 > /proc/hps/num_limit_power_serv
echo 2 > /proc/hps/num_limit_thermal
echo 2 > /proc/hps/num_limit_ultra_power_saving
echo $AWAKE_POWERSAVE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $AWAKE_POWERSAVE_FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $AWAKE_POWERSAVE_FREQ > /proc/cpufreq/cpufreq_limited_max_freq_by_user
if [ $AWAKE_POWERSAVE_GOVERNOR -eq "interactive" ]; then
interactive_tweak
fi
$SYS_PERF_PROFILE_CURRENT=$SYS_PERF_PROFILE
;;
2)	#HYPER
echo "1" > /proc/hps/enabled
echo 8 > /proc/hps/num_limit_low_battery
echo 8 > /proc/hps/num_limit_power_serv
echo 8 > /proc/hps/num_limit_thermal
echo 8 > /proc/hps/num_limit_ultra_power_saving
echo $AWAKE_HYPER_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $AWAKE_HYPER_FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $AWAKE_HYPER_FREQ > /proc/cpufreq/cpufreq_limited_max_freq_by_user
if [ $AWAKE_HYPER_GOVERNOR -eq "interactive" ]; then
interactive_tweak
fi
$SYS_PERF_PROFILE_CURRENT=$SYS_PERF_PROFILE
;;
*)	#NORMAL
echo "1" > /proc/hps/enabled
echo 8 > /proc/hps/num_limit_low_battery
echo 8 > /proc/hps/num_limit_power_serv
echo 4 > /proc/hps/num_limit_thermal
echo 4 > /proc/hps/num_limit_ultra_power_saving
echo $AWAKE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $AWAKE_FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $AWAKE_FREQ > /proc/cpufreq/cpufreq_limited_max_freq_by_user
if [ $AWAKE_GOVERNOR -eq "interactive" ]; then
interactive_tweak
fi
$SYS_PERF_PROFILE_CURRENT=$SYS_PERF_PROFILE
;;
esac
fi
ALREADY_AWAKE=1
ALREADY_SLEEP=0
#Reconnect WIFI or DATA
if [ -f /sdcard/sysperf/sys.perf.autodata ]; then
AUTO_DATA_ON_OFF=`cat /sdcard/sysperf/sys.perf.autodata`
else
AUTO_DATA_ON_OFF=1
fi;
if [ $AUTO_DATA_ON_OFF -ne "0" ]; then
if [ $ORI_WIFI_STATE -eq "1" ]; then
svc wifi enable
elif [ $ORI_DATA_STATE -eq "1" ]; then
svc data enable
fi;
fi;
}

##################################################################################
###########################Function to Set Sleep Profile##########################
##################################################################################
sleep_loop() {
#Store WIFI and DATA states
if [ -f /sdcard/sysperf/sys.perf.autodata ]; then
AUTO_DATA_ON_OFF=`cat /sdcard/sysperf/sys.perf.autodata`
else
AUTO_DATA_ON_OFF=1
fi;
if [ $AUTO_DATA_ON_OFF -ne "0" ]; then
dumpsys wifi | head -n 1 | grep -q "enabled"
if [ $? -eq "0" ]; then
ORI_WIFI_STATE="1"
else
ORI_WIFI_STATE="0"
fi;
dumpsys telephony.registry | grep "mDataConnectionState" | head -n 1 | grep -q "=2"
if [ $? -eq "0" ]; then
ORI_DATA_STATE="1"
else
ORI_DATA_STATE="0"
fi;
#Disconnect WIFI and DATA
svc data disable
svc wifi disable
fi;
###################SLEEP CPU GOVERNOR####################
echo $SLEEP_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "0" > /proc/hps/enabled
echo "0" > /sys/devices/system/cpu/cpu1/online
echo "0" > /sys/devices/system/cpu/cpu2/online
echo "0" > /sys/devices/system/cpu/cpu3/online
echo "0" > /sys/devices/system/cpu/cpu4/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu7/online
echo $SLEEP_FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $SLEEP_FREQ > /proc/cpufreq/cpufreq_limited_max_freq_by_user
SYS_PERF_PROFILE_CURRENT=99
ALREADY_AWAKE=0
ALREADY_SLEEP=1
}

#####################Call set_cpu_freq Function#####################
set_cpu_freq
done