From patchwork Tue Nov 11 18:50:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 409617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0879A140139 for ; Wed, 12 Nov 2014 05:53:17 +1100 (AEDT) Received: from localhost ([::1]:50253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoGZ1-00007w-1z for incoming@patchwork.ozlabs.org; Tue, 11 Nov 2014 13:53:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoGXC-00064O-I1 for qemu-devel@nongnu.org; Tue, 11 Nov 2014 13:51:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoGX2-00050O-L2 for qemu-devel@nongnu.org; Tue, 11 Nov 2014 13:51:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoGX2-00050E-E1 for qemu-devel@nongnu.org; Tue, 11 Nov 2014 13:51:12 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sABIp6ob030348 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 11 Nov 2014 13:51:07 -0500 Received: from localhost (ovpn-113-102.phx2.redhat.com [10.3.113.102]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sABIp5EI007739; Tue, 11 Nov 2014 13:51:06 -0500 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 11 Nov 2014 16:50:54 -0200 Message-Id: <1415731856-14121-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1415731856-14121-1-git-send-email-ehabkost@redhat.com> References: <1415731856-14121-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , Andrew Jones , Peter Lieven Subject: [Qemu-devel] [PATCH v2 1/3] vl: Avoid unnecessary 'if' nesting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Just a coding style change, to make other changes easier to review. Signed-off-by: Eduardo Habkost Reviewed-by: Andrew Jones --- vl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index f4a6e5e..c1bfc9b 100644 --- a/vl.c +++ b/vl.c @@ -1284,13 +1284,11 @@ static void smp_parse(QemuOpts *opts) if (cpus == 0) { cpus = cores * threads * sockets; } + } else if (cores == 0) { + threads = threads > 0 ? threads : 1; + cores = cpus / (sockets * threads); } else { - if (cores == 0) { - threads = threads > 0 ? threads : 1; - cores = cpus / (sockets * threads); - } else { - threads = cpus / (cores * sockets); - } + threads = cpus / (cores * sockets); } max_cpus = qemu_opt_get_number(opts, "maxcpus", 0);