From nobody Wed Nov 12 07:09:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646300; cv=none; d=zoho.com; s=zohoarc; b=Yf7GQY1aXK9OmdgrTQaaxuCeTDrLbzs5ae32XNWrnaHHQ7qwRhicyohiXVj9RetdQtUbnlkC06VqNpjEVlGiW4zE94HIv4nyMJTPq2cCoA6Rb+4iKe+Ilw/a9djQBlKC8NThCp8k9UfM56uj+1bvKOqvqDWyAHqyGcuh4Z+stU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646300; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=qBDro2giL3yKmpBcWouyjZdZj6DkaNRvbVZ4F52Urqc=; b=SJjNgwT0hz5WkFnl8ZPPSqcA/jLyEGAIC1vht1d4qcpvqro2Ct2srltobIbfj1bi/1IS+lx09fJJwkjfVdPHGktDg77Uj8vwgSppgSrmLtgb6ZSqtLuwM8oGfo0xV/VBBjLlqdTH2IOlt4C4Jxg951iQlB3CSW2wh2YrwtyuFAQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156864630057033.927133726125135; Mon, 16 Sep 2019 08:05:00 -0700 (PDT) Received: from localhost ([::1]:35670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sYd-0003QO-TA for importer@patchew.org; Mon, 16 Sep 2019 11:04:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53581) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sCn-0006I7-4U for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:42:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9sCl-0007Pm-HG for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:42:16 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:53560) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i9sCl-0007PL-88 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:42:15 -0400 Received: by mail-wm1-x32b.google.com with SMTP id i16so66533wmd.3 for ; Mon, 16 Sep 2019 07:42:15 -0700 (PDT) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id i14sm17024298wra.78.2019.09.16.07.42.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Sep 2019 07:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=qBDro2giL3yKmpBcWouyjZdZj6DkaNRvbVZ4F52Urqc=; b=Uy5I00YoR6QZNcCHg0GO34eEQ+dOyeSalui4EIjgMxdRmdddh04KsDEEkQZlQDoI7w vLoLFaeEP18J7NasZmlP3AlqC3dflywVwigjSQ4ZmCbS6MJc70WmzeuhxGjh8e9uFcrD GzisGljFz0zDRh4e/HRGsCSbo2nmCbSJsxiWOPt9DKFJlreTMMSOEkJC1JxkK92geLQs umKlRMaGeRGXZMxBuWVmpwKRZ0nHFcqiCA7Cd9Ac6ZKh604A+xhtP7EtjqkJOpKWS0oP dxhTzMwSXzMVBNo8/co7cczlUaOpej2LVC0KjXWgnLcV8da+GcMsVtDkg/V+anmTT+RF 4AuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=qBDro2giL3yKmpBcWouyjZdZj6DkaNRvbVZ4F52Urqc=; b=EieQo6Il/8ouvEF4IqpxTAmtJXSOOOt9hm5/peQYlGR2aQ0aGpwWYjUJMRse7JdoNw NbFGH8wpHoazypMeUvqwTUW6i9h7sf5RTAx1Y/BWfHabmIs7oRgrA/G0LuOV2AEk6SUs edi8uupd2WMoZDlyyplERmNvAl6Wm2EglA8OH6OZ5nYFXMgUFg4kPNLcnvGdran0w2Ho 69kbeFIDfibDtrw6DvTiTYrjNObug0G/GVCzeVMkvz2cNl5Ecn4AH8q9RtPc1zehA8jo ggIt85ery3jbZ2/qhKWcqxFij5fAhRlo9eJfAYpNQ/IJuUFnFcMrnLIEqvDNqDazddbY Sk2A== X-Gm-Message-State: APjAAAVKRU6Yb5oEFyZOQ1RW9q69Nj4Sb/TI/k9a5tw7Reb0nIKsr/CE EUog5gxTsDkKOqELv0MhlnePJgOx X-Google-Smtp-Source: APXvYqx3hlHbaEFZIviI00ch2wJLL+lmkTjtGW94KJT3ngqB/w2rjLuBleOS8iDjQN8/SWMGY7E3sw== X-Received: by 2002:a7b:c391:: with SMTP id s17mr66082wmj.94.1568644933985; Mon, 16 Sep 2019 07:42:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 16 Sep 2019 16:41:43 +0200 Message-Id: <1568644929-9124-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568644929-9124-1-git-send-email-pbonzini@redhat.com> References: <1568644929-9124-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b Subject: [Qemu-devel] [PULL 03/29] exec.c: get nodes_nb_alloc with one MAX calculation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wei Yang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Wei Yang The purpose of these two MAX here is to get the maximum of these three variables: A: map->nodes_nb + nodes B: map->nodes_nb_alloc C: alloc_hint We can write it like MAX(A, B, C). Since the if condition says A > B, this means MAX(A, B, C) =3D MAX(A, C). This patch just simplify the calculation a bit. Signed-off-by: Wei Yang Message-Id: <20190321082555.21118-4-richardw.yang@linux.intel.com> Signed-off-by: Paolo Bonzini --- exec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 8e0c400..ff3cb3e 100644 --- a/exec.c +++ b/exec.c @@ -227,8 +227,7 @@ static void phys_map_node_reserve(PhysPageMap *map, uns= igned nodes) { static unsigned alloc_hint =3D 16; if (map->nodes_nb + nodes > map->nodes_nb_alloc) { - map->nodes_nb_alloc =3D MAX(map->nodes_nb_alloc, alloc_hint); - map->nodes_nb_alloc =3D MAX(map->nodes_nb_alloc, map->nodes_nb + n= odes); + map->nodes_nb_alloc =3D MAX(alloc_hint, map->nodes_nb + nodes); map->nodes =3D g_renew(Node, map->nodes, map->nodes_nb_alloc); alloc_hint =3D map->nodes_nb_alloc; } --=20 1.8.3.1