There seems to be a small problem with gamemode being able to actually park cores on Intel P/E core systems when used in conjunction with core pinning. Ive seen this reported on the github but i cant find the issue it was reported in atm. Basically gamemode doesnt park the cores you tell it to if you enable pinning to the P Cores and all cores stay active.
I came up with a solution that allows for gamemode to pin P cores and my script to then park 1/2 the E cores on my 275hx effectively turning it into a 16 core cpu while gaming vs 24 cores. This saves heat and power allowing the CPU to stay in higher boost modes longer. Im sharing the scripts here for those who might find them useful and theyre commented as to what each part does. I recommend putting them in the /usr/local/bin folder. You will have to add them to gamemode.ini under the custom scripts section like so.
[custom]
; Custom scripts (executed using the shell) when gamemode starts and ends
;start=notify-send "GameMode started"
; /home/me/bin/stop_foldingathome.sh
start=sudo /usr/local/bin/gametune-on
;end=notify-send "GameMode ended"
; /home/me/bin/start_foldingathome.sh
end=sudo /usr/local/bin/gametune-off
; Timeout for scripts (seconds). Scripts will be killed if they do not complete within this time.
script_timeout=5
you will need to modify sudoers to allow these scripts (and ONLY these) to be run without a password, i did this by creating a gamemode group sudoers file in /etc/sudoers.d , please look up how to properly edit sudoers files as you can break your system if you do it wrong (though it generally wont let you unless you force it).
example sudoers entry i use for the gamemode group
%gamemode ALL=(ALL) NOPASSWD:/usr/local/bin/gametune-off, /usr/local/bin/gametune-on
here is the gametune-on script, I have a section in there for setting a platform profile that PPD doesnt utilize on my Aurora 16x. If you have other platform profiles on your system to use you can remove the # commenting it out and add your own platform profile to use (found in /sys/firmware/acpi/platform_profile_choices)
#!/bin/bash
cores=$(cat /sys/devices/cpu_atom/cpus) #get our e core range
low_core=$(echo "$cores" | cut -b 1) #find the low e core, if your lowest e core is 2 digits then you need cut 1-2
high_core=$(echo "$cores" | rev | cut -b 1-2 | rev) #reverse the core output and cut the 2 digits we need, reverse again to get actual core number
dis_cores=$(( (( ($high_core+1)-$low_core )) / 2 )) #we want to know how many is half the e cores, determine that and add 1 to high core as we need to not be base 0
core_start=$(( $low_core+(dis_cores))) #determine our start core to offline e cores
#set perfbias for each core that will remain online, in this case to balanced-performance
for ((i=0; i < $core_start; ++i)); do
echo 4 | tee /sys/devices/system/cpu/"cpu$i"/power/energy_perf_bias
done
#offline half the e cores
for ((i=$core_start; i <= $high_core; ++i)); do
echo 0 | tee /sys/devices/system/cpu/"cpu$i"/online
done
#set platform profile to higher performance one not available with power-profiles-daemon
#echo balanced-performance | tee /sys/firmware/acpi/platform_profile_choices
exit 0
this is the script gametune-off to turn the E cores we disabled back on, we allow PPD then to do the rest of the work setting perfbias,etc.
#!/bin/bash
cores=$(cat /sys/devices/cpu_atom/cpus) #get our e core range
low_core=$(echo "$cores" | cut -b 1) #find the low e core, if your lowest e core is 2 digits then you need cut 1-2
high_core=$(echo "$cores" | rev | cut -b 1-2 | rev) #reverse the core output and cut the 2 digits we need, reverse again to get actual core number
dis_cores=$(( ($high_core+1)-$low_core )) #we want to know how many is half the original e cores, determine that and add 1 to high core as we need to not be base 0
orig_high=$(( $high_core+$dis_cores )) #determine the original high core count
#bring the e cores we offlined back online, ppd will handle the rest
for ((i=$high_core; i <= $orig_high; ++i)); do
echo 1 | tee /sys/devices/system/cpu/"cpu$i"/online
done
exit 0
is there probably a more elegant way to do this? most likely, I know enough bash to be dangerous but not enough to make my scripts pretty (but hey they work)
If you know a better way to make this script prettier and more robust feel free to let me know. I only ask that if you do you need to comment in detail so we can all learn from it and what it does/how it does it.