[pve-devel] [PATCH manager] pvestatd: fix rebalancing cpusets for cgroupv2

Aaron Lauterer a.lauterer at proxmox.com
Tue Oct 19 14:01:07 CEST 2021


tested this by running a few containers with some cores, so that the majority will be used by the containers and then setting the `lxc.cgroup2.cpuset.cpus: 9-12` option for one container and restarting said container.

Without the patch, it would not get assigned all cores set with this manual setting, if the `cores` parameter was lower. With this patch, it does get the cores assigned and other containers without fixed cores assignments are vacated to other cores.

Assuming that this is the expected behavior that this patch tries to get back for cgroups v2:

Tested-By: Aaron Lauterer <a.lauterer at proxmox.com>

On 10/14/21 08:51, Oguz Bektas wrote:
> currently we only check the entry for cgroup v1 to decide if cores
> should be rebalanced. extend the check to include cgroup v2 entries.
> 
> reported in forum [0]
> 
> [0]: https://forum.proxmox.com/threads/hard-set-streams-for-lxc-container.97768/
> 
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
>   PVE/Service/pvestatd.pm | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
> index 7193388c..26d96bb2 100755
> --- a/PVE/Service/pvestatd.pm
> +++ b/PVE/Service/pvestatd.pm
> @@ -343,8 +343,9 @@ sub rebalance_lxc_containers {
>   
>   	my @cpuset_members = $cpuset->members();
>   
> -	if (!PVE::LXC::Config->has_lxc_entry($conf, 'lxc.cgroup.cpuset.cpus')) {
> -
> +	if (!PVE::LXC::Config->has_lxc_entry($conf, 'lxc.cgroup.cpuset.cpus')
> +	    && !PVE::LXC::Config->has_lxc_entry($conf, 'lxc.cgroup2.cpuset.cpus')
> +	) {
>   	    my $cores = $conf->{cores} || $cpucount;
>   	    $cores = $cpucount if $cores > $cpucount;
>   
> 





More information about the pve-devel mailing list