From nobody Mon Feb 9 03:14:31 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=1639052586; cv=none; d=zohomail.com; s=zohoarc; b=J41ZFzs2ikeUF7PrGG3VsDMHFbDQHD10nrBZhh2riZTmjMDvmi4Y3G0FJDoCcqRMy25QVSXb9XDYF78Hdrf9cHce3dSynSl4w9cz22qWxirFtnogTxQkmbKjlsviWIs2kaeLTjkZ9s2JPdoHiIsnawRqnEJvZ55aWwpJlrMTgtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639052586; 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=q/YeSs9xNSlb9UICzbyzjhtTD4DGZ8s7Xi0vUE5Fd6A=; b=ZI5ztpNMF9rbN4jgi+x0bqQst39WPXTzYJqkHWYdETqH4w/7UazQ+qX0iePb/xO2mh/+H/Vp0ZsquZawj2K2aRJFCfVMYr691hX0UPQzbzJZh1AhtBIlX7qSYE6fmojlf0unxenl3Imm/0uo9GEZ7ZhtFiKidXgO2riye+hkfMI= 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 1639052586562219.70045190834674; Thu, 9 Dec 2021 04:23:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-351-VJAqWD_kMgGrx1QAPpIFKA-1; Thu, 09 Dec 2021 07:22:43 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E37AA81CCB8; Thu, 9 Dec 2021 12:22:37 +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 C77715E275; Thu, 9 Dec 2021 12:22:37 +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 9A77D1802E2A; Thu, 9 Dec 2021 12:22:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B9CMWS1015738 for ; Thu, 9 Dec 2021 07:22:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id D729517CD9; Thu, 9 Dec 2021 12:22:32 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BBC45E24E for ; Thu, 9 Dec 2021 12:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639052585; 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=q/YeSs9xNSlb9UICzbyzjhtTD4DGZ8s7Xi0vUE5Fd6A=; b=ScutQnHh3zFDJMTLSX/K+qflPB5RpUUJyeBprxk5sj9QuKQVsuLajVi5ZfLpjevpsPR2dy SJI1Nj0E3XQJqBeSd83BdmFOAx2Ses+TxGuxaNOYNLhZiXVgi4oz1rtzpnMkPRJXdIre0D hhMZMLsYGLydkMV4FeNJM0NfXEr5IWg= X-MC-Unique: VJAqWD_kMgGrx1QAPpIFKA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 33/36] virLXCControllerSetup(Resource|Cgroup)Limits: Refactor cleanup Date: Thu, 9 Dec 2021 13:18:38 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.14 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: 1639052587722100003 Content-Type: text/plain; charset="utf-8" Remove the pointless cleanup sections. Signed-off-by: Peter Krempa --- src/lxc/lxc_controller.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index ae1f090077..c577d6a427 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -808,7 +808,6 @@ static int virLXCControllerGetNumadAdvice(virLXCControl= ler *ctrl, static int virLXCControllerSetupResourceLimits(virLXCController *ctrl) { g_autoptr(virBitmap) auto_nodeset =3D NULL; - int ret =3D -1; virBitmap *nodeset =3D NULL; virDomainNumatuneMemMode mode; @@ -824,21 +823,19 @@ static int virLXCControllerSetupResourceLimits(virLXC= Controller *ctrl) VIR_DEBUG("Setting up process resource limits"); if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0) - goto cleanup; + return -1; nodeset =3D virDomainNumatuneGetNodeset(ctrl->def->numa, auto_= nodeset, -1); if (virNumaSetupMemoryPolicy(mode, nodeset) < 0) - goto cleanup; + return -1; } } if (virLXCControllerSetupCpuAffinity(ctrl) < 0) - goto cleanup; + return -1; - ret =3D 0; - cleanup: - return ret; + return 0; } @@ -849,14 +846,13 @@ static int virLXCControllerSetupResourceLimits(virLXC= Controller *ctrl) static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl) { g_autoptr(virBitmap) auto_nodeset =3D NULL; - int ret =3D -1; virBitmap *nodeset =3D NULL; size_t i; VIR_DEBUG("Setting up cgroup resource limits"); if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0) - goto cleanup; + return -1; nodeset =3D virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset,= -1); @@ -864,23 +860,21 @@ static int virLXCControllerSetupCgroupLimits(virLXCCo= ntroller *ctrl) getpid(), ctrl->nnicindexes, ctrl->nicindexes))) - goto cleanup; + return -1; if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->initpid) < 0) - goto cleanup; + return -1; /* Add all qemu-nbd tasks to the cgroup */ for (i =3D 0; i < ctrl->nnbdpids; i++) { if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->nbdpids[i]) < 0) - goto cleanup; + return -1; } if (virLXCCgroupSetup(ctrl->def, ctrl->cgroup, nodeset) < 0) - goto cleanup; + return -1; - ret =3D 0; - cleanup: - return ret; + return 0; } --=20 2.31.1