From nobody Sun Feb 8 13:45:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1606317931; cv=none; d=zohomail.com; s=zohoarc; b=eYn8JU0Noak/TyJ+6K76kIuLwqyasXaH5R5+QTA0FNIqiqfZyXoWvduWz3enQbob8z3i+DmCdjmgiOTx3qMlI/fKSKbhpGIykZunBHPxCzn2e+koFzRzuoxjWsuAFBDR8G7W/NYXJqzwJQaUhTqEJPACHMs/vRfAt9Eg8yrDbaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606317931; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3/Eln6RlxTuVVg1exiLlvFxjWsm2Xcvs+fP9kAdKyRs=; b=R0a9lbze4OFSEQKYF7EYBa2vNV0xBBKDJHbM6j4qXwx3CkGMKUCwDYyVGw+HMZY5va3+7D+ZVMP45VtLqViUqgHaWASNrEUnPcVbLM92ey/kXdxsHUKchg59UFCIddd77kbZAoKjqzJfaGUCJ5LnR1AqlapoQNv6ZMEHIO3D/T8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606317931102433.8690646540582; Wed, 25 Nov 2020 07:25:31 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-550-ylQhz5X9P3yH0HCxZwYDpQ-1; Wed, 25 Nov 2020 10:25:25 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7885C742C; Wed, 25 Nov 2020 15:25:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D8C45D720; Wed, 25 Nov 2020 15:25:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 19E5E1809CA0; Wed, 25 Nov 2020 15:25:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0APEbqlJ020396 for ; Wed, 25 Nov 2020 09:37:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 554695D71B; Wed, 25 Nov 2020 14:37:52 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5C475D6AC for ; Wed, 25 Nov 2020 14:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606317929; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3/Eln6RlxTuVVg1exiLlvFxjWsm2Xcvs+fP9kAdKyRs=; b=h4tEHn9T2YDBBCOrTV5JlYUCPoK8p8lxLxfIqeS8LGPpeTvwqzo1UOXSbqHjUkeLOYgHIa QLNoHkgTcJkI9AtzVTgKXN6laX8BIaAkOMl50R98caH6XDdFwtF65t2kLbtoUUJd1t5Z5C 93PEyNhmiL+V6wZ9CQI3tUcgPfCLl4g= X-MC-Unique: ylQhz5X9P3yH0HCxZwYDpQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] vircgroupv2: use defines for cpu period and quota limits Date: Wed, 25 Nov 2020 15:37:43 +0100 Message-Id: <99fc56da123d601228d123465fd0c412d69a6054.1606314162.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 2b32f614e4..22da3a5c6a 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -1482,12 +1482,12 @@ virCgroupV2SetCpuCfsPeriod(virCgroupPtr group, g_autofree char *str =3D NULL; char *tmp; =20 - /* The cfs_period should be greater or equal than 1ms, and less or equ= al - * than 1s. - */ - if (cfs_period < 1000 || cfs_period > 1000000) { + if (cfs_period < VIR_CGROUP_CPU_PERIOD_MIN || + cfs_period > VIR_CGROUP_CPU_PERIOD_MAX) { virReportError(VIR_ERR_INVALID_ARG, - _("cfs_period '%llu' must be in range (1000, 100000= 0)"), + _("cfs_period '%llu' must be in range (%llu, %llu)"= ), + VIR_CGROUP_CPU_PERIOD_MIN, + VIR_CGROUP_CPU_PERIOD_MAX, cfs_period); return -1; } @@ -1543,17 +1543,18 @@ static int virCgroupV2SetCpuCfsQuota(virCgroupPtr group, long long cfs_quota) { - /* The cfs_quota should be greater or equal than 1ms */ if (cfs_quota >=3D 0 && - (cfs_quota < 1000 || - cfs_quota > ULLONG_MAX / 1000)) { + (cfs_quota < VIR_CGROUP_CPU_QUOTA_MIN || + cfs_quota > VIR_CGROUP_CPU_QUOTA_MAX)) { virReportError(VIR_ERR_INVALID_ARG, - _("cfs_quota '%lld' must be in range (1000, %llu)"), - cfs_quota, ULLONG_MAX / 1000); + _("cfs_quota '%lld' must be in range (%llu, %llu)"), + cfs_quota, + VIR_CGROUP_CPU_QUOTA_MIN, + VIR_CGROUP_CPU_QUOTA_MAX); return -1; } =20 - if (cfs_quota =3D=3D ULLONG_MAX / 1000) { + if (cfs_quota =3D=3D VIR_CGROUP_CPU_QUOTA_MAX) { return virCgroupSetValueStr(group, VIR_CGROUP_CONTROLLER_CPU, "cpu.max", "max"); @@ -1578,7 +1579,7 @@ virCgroupV2GetCpuCfsQuota(virCgroupPtr group, } =20 if (STREQLEN(str, "max", 3)) { - *cfs_quota =3D ULLONG_MAX / 1000; + *cfs_quota =3D VIR_CGROUP_CPU_QUOTA_MAX; return 0; } =20 --=20 2.26.2