This script is designed for QubesOS. It automatically reads the current focused window's parent VM and pins the VM to all CPU cores (or to performance cores, this only needs one line's worth of changes). The default assumption is that all VMs are by default pinned to E-cores on asymmetrical CPUs and they get given access to all cores when in focus for additional snappiness and performance. See https://forum.qubes-os.org/t/cpu-pinning-alder-lake/17949 for information on how to set up the prerequisite core pinning required for this script to run well.
When the USR1 signal is received by the script, it resets all dynamic pins, that is
it reset the pinning state to whatever it was before running the script. This does not
make the script exit.
- Set up automatic CPU pinning via https://github.com/Atrate/Qubes-CPU-Pinning or based on information in this Qubes forum thread
- Decide on the cores you want to pin focused windows' VMs to (
TARGET_CORESvariable) - Decide on the VMs you want to ignore based on their current pins (
IGNORE_PINvariable) - Download
window_boost.shand move it todom0(e.g. to/usr/local/bin/window_boost.sh - Make it executable (
sudo chmod +x /usr/local/bin/window_boost.sh) - Launch the script (
/usr/local/bin/window_boost.sh) - Optional: launch the script automatically (example for autostart on
i3:exec_always --no-startup-id /usr/local/bin/window_boost.sh) - Optional: configure keybind to clear all dynamic pins (e.g. before locking screen) (example for
i3:bindsym $mod+l exec --no-startup-id "pkill -USR1 window_boost.sh")
You can check whether the script works with this command in dom0:
watch -d -n 0.5 "xl vcpu-list | tr -s ' ' | cut -d' ' -f 1,7- | uniq | column -t -l 2"
- If you have more specific pins defined for a VM (such as "vCPU 1 to CPUs 2, 3 and 4, vCPU 2 to CPUs 4, 6, 7), the script will probably not work well.
PRs to fix those issues are welcome :).
See the qubes-utils repo for links to other utilities I've written for Qubes.
This project is licensed under the AGPL-3.0-or-later.
