public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH common] fix #5529: cgroup: correctly handle change_cpu_quota without a quota
@ 2024-07-09  9:09 Wolfgang Bumiller
  2024-07-22 17:08 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfgang Bumiller @ 2024-07-09  9:09 UTC (permalink / raw)
  To: pve-devel

The function can be called with
- neither quota nor period
- only a period (quota will be 'max')
- both

$quota was therefore defaulted to 'max' and the check for whether
values were provided should use $period instead of $quota.
Also move the defaulting-assignment into the condition for clarity.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
 src/PVE/CGroup.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/CGroup.pm b/src/PVE/CGroup.pm
index e2839cf..4d523e2 100644
--- a/src/PVE/CGroup.pm
+++ b/src/PVE/CGroup.pm
@@ -469,8 +469,8 @@ sub change_cpu_quota {
     } elsif ($ver == 2) {
 	# cgroupv2 environment, an undefined (unlimited) quota is defined as "max"
 	# in this interface:
-	$quota //= 'max'; # unlimited
-	if (defined($quota)) {
+	if (defined($period)) {
+	    $quota //= 'max'; # unlimited
 	    PVE::ProcFSTools::write_proc_entry("$path/cpu.max", "$quota $period");
 	} else {
 	    # we're allowed to only write the quota:
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] applied: [PATCH common] fix #5529: cgroup: correctly handle change_cpu_quota without a quota
  2024-07-09  9:09 [pve-devel] [PATCH common] fix #5529: cgroup: correctly handle change_cpu_quota without a quota Wolfgang Bumiller
@ 2024-07-22 17:08 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-07-22 17:08 UTC (permalink / raw)
  To: Proxmox VE development discussion, Wolfgang Bumiller

Am 09/07/2024 um 11:09 schrieb Wolfgang Bumiller:
> The function can be called with
> - neither quota nor period
> - only a period (quota will be 'max')
> - both
> 
> $quota was therefore defaulted to 'max' and the check for whether
> values were provided should use $period instead of $quota.
> Also move the defaulting-assignment into the condition for clarity.
> 
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
>  src/PVE/CGroup.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
>

applied, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2024-07-22 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-09  9:09 [pve-devel] [PATCH common] fix #5529: cgroup: correctly handle change_cpu_quota without a quota Wolfgang Bumiller
2024-07-22 17:08 ` [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