public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] pvestatd: fix rebalancing cpusets for cgroupv2
@ 2021-10-14  6:51 Oguz Bektas
  2021-10-19 12:01 ` Aaron Lauterer
  0 siblings, 1 reply; 3+ messages in thread
From: Oguz Bektas @ 2021-10-14  6:51 UTC (permalink / raw)
  To: pve-devel

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@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;
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH manager] pvestatd: fix rebalancing cpusets for cgroupv2
  2021-10-14  6:51 [pve-devel] [PATCH manager] pvestatd: fix rebalancing cpusets for cgroupv2 Oguz Bektas
@ 2021-10-19 12:01 ` Aaron Lauterer
  2021-10-20 14:47   ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lauterer @ 2021-10-19 12:01 UTC (permalink / raw)
  To: Proxmox VE development discussion, Oguz Bektas

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@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@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;
>   
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH manager] pvestatd: fix rebalancing cpusets for cgroupv2
  2021-10-19 12:01 ` Aaron Lauterer
@ 2021-10-20 14:47   ` Thomas Lamprecht
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2021-10-20 14:47 UTC (permalink / raw)
  To: Proxmox VE development discussion, Aaron Lauterer, Oguz Bektas

On 19.10.21 14:01, Aaron Lauterer wrote:
> Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>

with above:

applied, thanks to both of you!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-20 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14  6:51 [pve-devel] [PATCH manager] pvestatd: fix rebalancing cpusets for cgroupv2 Oguz Bektas
2021-10-19 12:01 ` Aaron Lauterer
2021-10-20 14:47   ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal