From nobody Sun Feb 8 12:20:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1606317927; cv=none; d=zohomail.com; s=zohoarc; b=PwNlOV6OIQyp7SCgeI4V6ixUa/apo2/RjbWdHsvZ2ad5YaMtUnQ7afAOLxBskN1MSGhBYiuKpLCD3u+ulHZdTyzTyzkGvdqknxmMyq69ggnV9CHpt2ErVkr8QaRIRDykBop+a9kICsZkVD1eOj+cWCTNSQlZZBpVmNxDYFvf7lY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606317927; 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=6E16Dlu0Xu1u0vFfL7F1j9XtK3BcxTLrxOSYYqSU8kw=; b=VzmsL1tKR6M9XcZ6XSHRxV5IuUTBZBRox+t4jkKw7ovI9VfIREkz+kbr3fFOA7iWMSpddmqCUVbaqnvalsDTcyw4ZUbfIDdJkgr8VGxpPCvqAFvqO6YoS082YFtKyRttbinvox7qOyFFL9sYeABrHUlav8mmc6pdhD6n3d5qV7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606317926816843.7781477339354; Wed, 25 Nov 2020 07:25:26 -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-587-g6WZpufmODa-ZGtnUNkN_A-1; Wed, 25 Nov 2020 10:25:23 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C5F7101AFD0; Wed, 25 Nov 2020 15:25:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78A741002393; Wed, 25 Nov 2020 15:25:16 +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 44AEF57684; Wed, 25 Nov 2020 15:25:16 +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 0APEbp9X020391 for ; Wed, 25 Nov 2020 09:37:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 725AF5D71B; Wed, 25 Nov 2020 14:37:51 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id E20A15D6AC for ; Wed, 25 Nov 2020 14:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606317925; 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=6E16Dlu0Xu1u0vFfL7F1j9XtK3BcxTLrxOSYYqSU8kw=; b=Aputxz4cKxObq8tFLf10mP5EqOUwOdJ36sF8PyTL0qJSfbEZno1bpW5XxhrhNvQgJUk8rD qE7cJkXDzLoSrpMLS8qXexhLxjuXmKqHOA/LjoqxJp1MJZ0Bo2G9ZKbo3vEUY2TG5YaEo9 1DNGEM2BXsAd1IqYWkw0KGgYTIFGHOI= X-MC-Unique: g6WZpufmODa-ZGtnUNkN_A-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] vircgroupv1: use defines for cpu period and quota limits Date: Wed, 25 Nov 2020 15:37:42 +0100 Message-Id: <0e443259ede3d24652c588921076ade13aee4d45.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.84 on 10.5.11.22 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/vircgroupv1.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 984cd50409..06849efd38 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -1881,13 +1881,13 @@ static int virCgroupV1SetCpuCfsPeriod(virCgroupPtr group, unsigned long long cfs_period) { - /* 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); + _("cfs_period '%llu' must be in range (%llu, %llu)"= ), + cfs_period, + VIR_CGROUP_CPU_PERIOD_MIN, + VIR_CGROUP_CPU_PERIOD_MAX); return -1; } =20 @@ -1911,13 +1911,14 @@ static int virCgroupV1SetCpuCfsQuota(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 --=20 2.26.2