|
|
397dc2 |
From 2fb78d18ea95c2dcb4c5b0e29171636e51bb2149 Mon Sep 17 00:00:00 2001
|
|
|
397dc2 |
Message-Id: <2fb78d18ea95c2dcb4c5b0e29171636e51bb2149@dist-git>
|
|
|
397dc2 |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
397dc2 |
Date: Thu, 21 Jan 2021 10:24:04 -0300
|
|
|
397dc2 |
Subject: [PATCH] vircgroupv1: use defines for cpu period and quota limits
|
|
|
397dc2 |
|
|
|
397dc2 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
397dc2 |
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
|
397dc2 |
(cherry picked from commit bc760f4d7c4f964fadcb2a73e126b0053e7a9b06)
|
|
|
397dc2 |
|
|
|
397dc2 |
https://bugzilla.redhat.com/1915733
|
|
|
397dc2 |
|
|
|
397dc2 |
Signed-off-by: Daniel Henrique Barboza <dbarboza@redhat.com>
|
|
|
397dc2 |
Message-Id: <20210121132406.337681-3-dbarboza@redhat.com>
|
|
|
397dc2 |
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
397dc2 |
---
|
|
|
397dc2 |
src/util/vircgroupv1.c | 23 ++++++++++++-----------
|
|
|
397dc2 |
1 file changed, 12 insertions(+), 11 deletions(-)
|
|
|
397dc2 |
|
|
|
397dc2 |
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
|
|
|
397dc2 |
index d2ec7106db..c35088a3c4 100644
|
|
|
397dc2 |
--- a/src/util/vircgroupv1.c
|
|
|
397dc2 |
+++ b/src/util/vircgroupv1.c
|
|
|
397dc2 |
@@ -1869,13 +1869,13 @@ static int
|
|
|
397dc2 |
virCgroupV1SetCpuCfsPeriod(virCgroupPtr group,
|
|
|
397dc2 |
unsigned long long cfs_period)
|
|
|
397dc2 |
{
|
|
|
397dc2 |
- /* The cfs_period should be greater or equal than 1ms, and less or equal
|
|
|
397dc2 |
- * than 1s.
|
|
|
397dc2 |
- */
|
|
|
397dc2 |
- if (cfs_period < 1000 || cfs_period > 1000000) {
|
|
|
397dc2 |
+ if (cfs_period < VIR_CGROUP_CPU_PERIOD_MIN ||
|
|
|
397dc2 |
+ cfs_period > VIR_CGROUP_CPU_PERIOD_MAX) {
|
|
|
397dc2 |
virReportError(VIR_ERR_INVALID_ARG,
|
|
|
397dc2 |
- _("cfs_period '%llu' must be in range (1000, 1000000)"),
|
|
|
397dc2 |
- cfs_period);
|
|
|
397dc2 |
+ _("cfs_period '%llu' must be in range (%llu, %llu)"),
|
|
|
397dc2 |
+ cfs_period,
|
|
|
397dc2 |
+ VIR_CGROUP_CPU_PERIOD_MIN,
|
|
|
397dc2 |
+ VIR_CGROUP_CPU_PERIOD_MAX);
|
|
|
397dc2 |
return -1;
|
|
|
397dc2 |
}
|
|
|
397dc2 |
|
|
|
397dc2 |
@@ -1899,13 +1899,14 @@ static int
|
|
|
397dc2 |
virCgroupV1SetCpuCfsQuota(virCgroupPtr group,
|
|
|
397dc2 |
long long cfs_quota)
|
|
|
397dc2 |
{
|
|
|
397dc2 |
- /* The cfs_quota should be greater or equal than 1ms */
|
|
|
397dc2 |
if (cfs_quota >= 0 &&
|
|
|
397dc2 |
- (cfs_quota < 1000 ||
|
|
|
397dc2 |
- cfs_quota > ULLONG_MAX / 1000)) {
|
|
|
397dc2 |
+ (cfs_quota < VIR_CGROUP_CPU_QUOTA_MIN ||
|
|
|
397dc2 |
+ cfs_quota > VIR_CGROUP_CPU_QUOTA_MAX)) {
|
|
|
397dc2 |
virReportError(VIR_ERR_INVALID_ARG,
|
|
|
397dc2 |
- _("cfs_quota '%lld' must be in range (1000, %llu)"),
|
|
|
397dc2 |
- cfs_quota, ULLONG_MAX / 1000);
|
|
|
397dc2 |
+ _("cfs_quota '%lld' must be in range (%llu, %llu)"),
|
|
|
397dc2 |
+ cfs_quota,
|
|
|
397dc2 |
+ VIR_CGROUP_CPU_QUOTA_MIN,
|
|
|
397dc2 |
+ VIR_CGROUP_CPU_QUOTA_MAX);
|
|
|
397dc2 |
return -1;
|
|
|
397dc2 |
}
|
|
|
397dc2 |
|
|
|
397dc2 |
--
|
|
|
397dc2 |
2.30.0
|
|
|
397dc2 |
|