3 #use last CPU for host. Why not the first?
4 #many devices tend to use cpu0 by default so
6 HOST_AFFINITY
=$
(lscpu
-p=cpu |
tail -1)
8 #run command on all cpus
9 for cpu
in $
(seq 0 $HOST_AFFINITY)
11 #Don't run guest and host on same CPU
12 #It actually works ok if using signalling
14 (echo "$@" |
grep -e "--sleep" > /dev
/null
) || \
15 test $HOST_AFFINITY '!=' $cpu
17 echo "GUEST AFFINITY $cpu"
18 "$@" --host-affinity $HOST_AFFINITY --guest-affinity $cpu
21 echo "NO GUEST AFFINITY"
22 "$@" --host-affinity $HOST_AFFINITY