2019-10-12 22:55:19 +00:00
|
|
|
#!/bin/bash
|
2020-08-21 20:19:00 +00:00
|
|
|
|
|
|
|
prepare() {
|
2021-03-04 22:03:16 +00:00
|
|
|
systemctl start win10-usb
|
2021-09-29 23:52:56 +00:00
|
|
|
|
2021-03-04 22:03:16 +00:00
|
|
|
vfio-isolate -u /tmp/win10.undo \
|
|
|
|
drop-caches \
|
|
|
|
compact-memory \
|
|
|
|
irq-affinity mask C1-3,5-7 \
|
2021-09-29 23:52:56 +00:00
|
|
|
cpuset-create --cpus C0,4 /host.slice \
|
|
|
|
cpuset-create --cpus C1-3,5-7 -nlb /win10.slice \
|
|
|
|
move-tasks / /host.slice \
|
2021-03-04 22:03:16 +00:00
|
|
|
cpu-governor performance C0-7
|
2020-08-21 20:19:00 +00:00
|
|
|
|
|
|
|
for _ in $(seq 5); do
|
|
|
|
sleep 3
|
|
|
|
# assign hugepages
|
|
|
|
sysctl -w vm.nr_hugepages=8192 && break
|
|
|
|
done
|
|
|
|
sleep 10
|
|
|
|
}
|
|
|
|
|
|
|
|
release() {
|
|
|
|
echo "Restore system"
|
2021-07-22 13:40:24 +00:00
|
|
|
|
|
|
|
# restore cgroupv2
|
|
|
|
systemctl set-property --runtime -- user.slice AllowedCPUs=0,1,2,3,4,5,6,7
|
|
|
|
systemctl set-property --runtime -- system.slice AllowedCPUs=0,1,2,3,4,5,6,7
|
|
|
|
systemctl set-property --runtime -- init.scope AllowedCPUs=0,1,2,3,4,5,6,7
|
|
|
|
|
2021-03-04 22:03:16 +00:00
|
|
|
vfio-isolate restore /tmp/win10.undo
|
|
|
|
systemctl stop win10-usb
|
2020-08-21 20:19:00 +00:00
|
|
|
sysctl -w vm.nr_hugepages=0
|
|
|
|
}
|
|
|
|
|
2019-10-12 22:55:19 +00:00
|
|
|
if [ "$1" == "win10" ]; then
|
|
|
|
if [ "$2" == "prepare" ]; then
|
2020-08-21 20:19:00 +00:00
|
|
|
prepare
|
2019-10-12 22:55:19 +00:00
|
|
|
fi
|
|
|
|
if [ "$2" == "release" ]; then
|
2020-08-21 20:19:00 +00:00
|
|
|
release
|
2019-10-12 22:55:19 +00:00
|
|
|
fi
|
|
|
|
fi
|