From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common] fix #5529: cgroup: correctly handle change_cpu_quota without a quota
Date: Tue, 9 Jul 2024 11:09:52 +0200 [thread overview]
Message-ID: <20240709090952.147779-1-w.bumiller@proxmox.com> (raw)
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
next reply other threads:[~2024-07-09 9:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 9:09 Wolfgang Bumiller [this message]
2024-07-22 17:08 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240709090952.147779-1-w.bumiller@proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox