From nobody Mon Feb 9 10:30:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1678812865; cv=none; d=zohomail.com; s=zohoarc; b=g4JtRHkcIXz+z6E9fMzUE9RZXa9xMWdako8+yK114gzSw/ollOAgxFEElR91ujpKd2KD3qa+hpcChP20FUh1p9IGB/XJYQ0kGspCNmcZmx98vxRQIRKD3k3eqPOA73UNLp2u05/3wgIQ002Lw2qkaAtZ5OQqxhlGB2jDjG7Y1VI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678812865; 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=irADyf5Pc9gceCZz2M0W3UMS2+ofdlDtVGgEX9Gybbk=; b=MlK0gpboENdpuqcUQcfIkGQUgqjC3Oum3yxNmox4oO6XjrjtQCj4bhHCvNGn3o3gTyB22C2NX3HHO+6mAFd+2jOc/9rk61bWFpzoCxYME26gm0z9rbm4ACcOkNjcOe8TKxl6HxdBUgTu+k6V6SC3Jt1M2ExH+UseitWz9Nt7Qxs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1678812865689396.55032715215555; Tue, 14 Mar 2023 09:54:25 -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-77-yIToI7YHMnmflso05STR-g-1; Tue, 14 Mar 2023 12:53:19 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B72EB857F6D; Tue, 14 Mar 2023 16:53:12 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A18401410F1B; Tue, 14 Mar 2023 16:53:12 +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 BC3361946A7E; Tue, 14 Mar 2023 16:53:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E231F19465BA for ; Tue, 14 Mar 2023 16:52:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 74DF52166B34; Tue, 14 Mar 2023 16:52:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B1FB2166B26 for ; Tue, 14 Mar 2023 16:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678812863; 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=irADyf5Pc9gceCZz2M0W3UMS2+ofdlDtVGgEX9Gybbk=; b=TV9fcpfayAmBCRQ3qJxy/v0kOz+cORVH2vWbYpMhytjULM8L+WkqW/xnDuN3va9dkJZZNt M+iIhuGEB0PsAQYt7Hej2L+OQx7fFEo0FcU88omaOfSMSmPcIZE246+WDVSErQRDzdfD6s AZoj1cYV0gUFfhdc/v8pyW1SvwSBOJQ= X-MC-Unique: yIToI7YHMnmflso05STR-g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 10/15] qemuBuildMemoryBackendProps: Join two conditions Date: Tue, 14 Mar 2023 17:52:24 +0100 Message-Id: <30447a8cbea8ab75089b9c3036396cb43dcd82ae.1678812657.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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 3.1 on 10.11.54.7 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: 1678812866435100001 Content-Type: text/plain; charset="utf-8"; x-default="true" There are two compound conditions in qemuBuildMemoryBackendProps() and each one checks for nodemask for NULL first. Join them into one bigger block. Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova --- src/qemu/qemu_command.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 929bcc0be1..b0cb252d0b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3437,19 +3437,21 @@ qemuBuildMemoryBackendProps(virJSONValue **backendP= rops, return -1; } =20 - /* Make sure the requested nodeset is sensible */ - if (nodemask && !virNumaNodesetIsAvailable(nodemask)) - return -1; - - /* If mode is "restrictive", we should only use cgroups setting allowe= d memory - * nodes, and skip passing the host-nodes and policy parameters to QEM= U command - * line which means we will use system default memory policy. */ - if (nodemask && mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { - if (virJSONValueObjectAdd(&props, - "m:host-nodes", nodemask, - "S:policy", qemuNumaPolicyTypeToString(m= ode), - NULL) < 0) + if (nodemask) { + /* Make sure the requested nodeset is sensible */ + if (!virNumaNodesetIsAvailable(nodemask)) return -1; + + /* If mode is "restrictive", we should only use cgroups setting al= lowed memory + * nodes, and skip passing the host-nodes and policy parameters to= QEMU command + * line which means we will use system default memory policy. */ + if (mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { + if (virJSONValueObjectAdd(&props, + "m:host-nodes", nodemask, + "S:policy", qemuNumaPolicyTypeToStri= ng(mode), + NULL) < 0) + return -1; + } } =20 /* If none of the following is requested... */ --=20 2.39.2