Skip to content

Commit

Permalink
cpu-vm: check that automatic CPU balancing works
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
  • Loading branch information
mihalicyn committed Apr 8, 2024
1 parent d7f82b6 commit 7e64511
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/cpu-vm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ done
lxc config set v1 limits.cpu="${cpuCount}"
[ "$(lxc exec v1 -- ls /sys/devices/system/cpu | grep -Ec 'cpu[[:digit:]]+')" -eq "${cpuCount}" ]

# check that CPU affinity is automatically set
QEMU_PID=$(lxc info v1 | grep PID | grep -o -E "([0-9]+)")

# Check that there are processes with pinning set
# It will be shown like this:
# pid 2894's current affinity list: 6
# pid 2895's current affinity list: 8
# pid 2897's current affinity list: 0-15
# pid 2898's current affinity list: 0-15
# pid 2899's current affinity list: 0-15
# 2894 and 2895 have affinity set, while others don't
taskset --cpu-list -a -p "${QEMU_PID}" | grep -v "0-${cpuCount}"

# Unset CPU limit
lxc config unset v1 limits.cpu

Expand Down

0 comments on commit 7e64511

Please sign in to comment.