Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM: Instance's CPU auto rebalancing/pinning #13257

Merged
merged 4 commits into from
Apr 5, 2024

Conversation

mihalicyn
Copy link
Member

@mihalicyn mihalicyn commented Apr 4, 2024

Make our pinning balancer aware of VM instances existence.

@mihalicyn mihalicyn force-pushed the vm_instance_cpu_auto_pinning branch from 26cbf19 to d6f8d7b Compare April 4, 2024 15:25
@tomponline tomponline changed the title VM instance's CPU auto rebalancing/pinning VM: instance's CPU auto rebalancing/pinning Apr 5, 2024
@tomponline tomponline changed the title VM: instance's CPU auto rebalancing/pinning VM: Instance's CPU auto rebalancing/pinning Apr 5, 2024
@mihalicyn mihalicyn force-pushed the vm_instance_cpu_auto_pinning branch from d6f8d7b to 968965b Compare April 5, 2024 10:27
@mihalicyn mihalicyn marked this pull request as ready for review April 5, 2024 10:28
@mihalicyn
Copy link
Member Author

As usual, I'll prepare tests in lxd-ci repo after this PR is merged

@mihalicyn mihalicyn force-pushed the vm_instance_cpu_auto_pinning branch from 968965b to 8248899 Compare April 5, 2024 12:54
lxd/devices.go Outdated Show resolved Hide resolved
Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits, but overall looks great thanks!

@mihalicyn mihalicyn force-pushed the vm_instance_cpu_auto_pinning branch 3 times, most recently from 0b22377 to f0e7d1c Compare April 5, 2024 14:29
@mihalicyn
Copy link
Member Author

Couple of nits, but overall looks great thanks!

Have updated. Thanks!

lxd/devices.go Outdated Show resolved Hide resolved
Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you remove the loggers from SetAffinity and return them as wrapped errors with contextual info added to the error message.

For the affinity set we can passed in, we can include that in the caller's logger context.

@mihalicyn mihalicyn force-pushed the vm_instance_cpu_auto_pinning branch from f0e7d1c to 1b48d64 Compare April 5, 2024 14:47
@mihalicyn
Copy link
Member Author

Please can you remove the loggers from SetAffinity and return them as wrapped errors with contextual info added to the error message.

Thanks! Fixed. I have left logger with with debug level only in one place where it's reasonable.

Refactor code a bit and make some adjustments in the comments
before supporting automatic core pinning support for VM instances
as we do for containers instances.

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
This VM instance method is used in the dynamic core balancer
code. Let's implement it properly.

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
…rTrigger

Calls to cgroup.TaskSchedulerTrigger can be very costly, let's avoid
calling it without real reason. We only have to call it when CPU limits
were changed for the instance.

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Put calls to the cgroup.TaskSchedulerTrigger in a few critical places:
- on instance start
- on instance CPU configuration change
- on instance stop

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
@mihalicyn mihalicyn force-pushed the vm_instance_cpu_auto_pinning branch from 1b48d64 to 801e031 Compare April 5, 2024 14:59
Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tomponline tomponline merged commit 7e48a31 into canonical:main Apr 5, 2024
24 of 28 checks passed
@mihalicyn
Copy link
Member Author

Test canonical/lxd-ci#132

mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Apr 8, 2024
mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Apr 8, 2024
mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Apr 8, 2024
mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Apr 8, 2024
mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Apr 8, 2024
mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants