37 lines
765 B
Bash
Executable File
37 lines
765 B
Bash
Executable File
#!/bin/bash
|
|
|
|
prepare() {
|
|
systemctl start win10-usb
|
|
|
|
vfio-isolate -u /tmp/win10.undo \
|
|
drop-caches \
|
|
compact-memory \
|
|
irq-affinity mask C1-3,5-7 \
|
|
cpuset-modify --cpus C0,4 /system.slice \
|
|
cpuset-modify --cpus C0,4 /user.slice \
|
|
move-tasks / /host.slice \
|
|
cpu-governor performance C0-7
|
|
|
|
for _ in $(seq 5); do
|
|
sleep 3
|
|
# assign hugepages
|
|
sysctl -w vm.nr_hugepages=8192 && break
|
|
done
|
|
sleep 10
|
|
}
|
|
|
|
release() {
|
|
systemctl stop win10-usb
|
|
vfio-isolate restore /tmp/win10.undo
|
|
sysctl -w vm.nr_hugepages=0
|
|
}
|
|
|
|
if [ "$1" == "win10" ]; then
|
|
if [ "$2" == "prepare" ]; then
|
|
prepare
|
|
fi
|
|
if [ "$2" == "release" ]; then
|
|
release
|
|
fi
|
|
fi
|