From nobody Mon Feb 9 01:49:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1648823926; cv=none; d=zohomail.com; s=zohoarc; b=dSTL8Ig2CA6bhCS4WkXEhjk6xARKwBWYSaBKZNb0NPCb7e9fA3Rvd2XLs+wU0mW4xOWGMtA2LlX5bVGbatlwWgPVW5G9vWY8AmBWGAkVk7JfHpvteDIoEBscwPsP4DqhZaoQjL4CAfs77/nIB4mwmLzQEVsNqTaqWknVV8R27+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648823926; 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=o649/lk57xdcfT5Dha+R4ROKnaWKzeEr2LUyUvIhzks=; b=SVgqAdqaViNvnRSCU2KfkBC1zJlQhCQ80jREfsqUYjzs2Fsunzw3ZocAkh1BKKAYAqmpkthglWD+gc5IFXKCuYo4sArUeA09/hfQQ1MutKL5p4JJXvLgzbrBqUgvqb+ZUEquXkfPTvI79q7E+HyuqocLtihW30/aSTYlVAU7iTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1648823926427842.1870841935818; Fri, 1 Apr 2022 07:38:46 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-421--AMNihjPMCWxFQbGpsCmAA-1; Fri, 01 Apr 2022 10:38:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECDD680281D; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5D52C5C86B; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 00C2F1947BBF; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E40131947BBE for ; Fri, 1 Apr 2022 14:38:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D5DFE40F013; Fri, 1 Apr 2022 14:38:37 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E342403372 for ; Fri, 1 Apr 2022 14:38:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648823925; 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=o649/lk57xdcfT5Dha+R4ROKnaWKzeEr2LUyUvIhzks=; b=FkaVS63D26dj0SE2yNYphLWAF43u3EM92uDIbGrGr8X+Z6cWSXhJvUA85zGhA3Locc0Jen GbkMUNnr6Eu6L+3+pCbBOnL3yjI3nOlc9sajBdcQnIMT6nGRFLEZEBJGAJWVvuPORTkixG asx6WsS79R2CYvKTCH2XCF3q0UGso3k= X-MC-Unique: -AMNihjPMCWxFQbGpsCmAA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] lib: Don't short circuit around virDomainCgroupSetupVcpuBW() Date: Fri, 1 Apr 2022 16:38:32 +0200 Message-Id: <79243a8413acd7cd296a384d5975814f1e0d1940.1648823888.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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) X-ZM-MESSAGEID: 1648823927995100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The virDomainCgroupSetupVcpuBW() is a NOP if both period and quota to set are zero. There's no need to check in all the callers for this special case. Signed-off-by: Michal Privoznik --- src/hypervisor/domain_cgroup.c | 6 ++---- src/qemu/qemu_driver.c | 12 ------------ src/qemu/qemu_process.c | 3 +-- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/hypervisor/domain_cgroup.c b/src/hypervisor/domain_cgroup.c index fc0ad284c8..920ec8c895 100644 --- a/src/hypervisor/domain_cgroup.c +++ b/src/hypervisor/domain_cgroup.c @@ -603,10 +603,8 @@ virDomainCgroupSetupGlobalCpuCgroup(virDomainObj *vm, autoNodeset, &mem_mask, -1) < = 0) return -1; =20 - if (period || quota) { - if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) - return -1; - } + if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) + return -1; =20 return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 77012eb527..547af4384f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8923,9 +8923,6 @@ static int qemuSetGlobalBWLive(virCgroup *cgroup, unsigned long long period, long long quota) { - if (period =3D=3D 0 && quota =3D=3D 0) - return 0; - if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) return -1; =20 @@ -9104,9 +9101,6 @@ qemuSetVcpusBWLive(virDomainObj *vm, virCgroup *cgrou= p, { size_t i; =20 - if (period =3D=3D 0 && quota =3D=3D 0) - return 0; - if (!qemuDomainHasVcpuPids(vm)) return 0; =20 @@ -9135,9 +9129,6 @@ qemuSetEmulatorBandwidthLive(virCgroup *cgroup, { g_autoptr(virCgroup) cgroup_emulator =3D NULL; =20 - if (period =3D=3D 0 && quota =3D=3D 0) - return 0; - if (virCgroupNewThread(cgroup, VIR_CGROUP_THREAD_EMULATOR, 0, false, &cgroup_emulator) < 0) return -1; @@ -9155,9 +9146,6 @@ qemuSetIOThreadsBWLive(virDomainObj *vm, virCgroup *c= group, { size_t i; =20 - if (period =3D=3D 0 && quota =3D=3D 0) - return 0; - if (!vm->def->niothreadids) return 0; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f110e4f3dd..f3eb742406 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2699,8 +2699,7 @@ qemuProcessSetupPid(virDomainObj *vm, =20 } =20 - if ((period || quota) && - virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) + if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) goto cleanup; =20 /* Move the thread to the sub dir */ --=20 2.35.1