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 based on information in this Qubes forum thread
- Decide on the cores you want to pin focused windows' VMs to (
TARGET_CORES
variable) - Decide on the VMs you want to ignore based on their current pins (
IGNORE_PIN
variable) - Download
window_boost.sh
and 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"
)
- The script only supports the
i3
window manager. - 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.
dom0
does not get its pinnings modified. This is by design, but a commandline switch to change that behavior could be implemented.
PRs to fix those issues are welcome :).
This project is licensed under the AGPL-3.0-or-later.