summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vl.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/vl.c b/vl.c
index 1a2da2b36a..56a17ddc6b 100644
--- a/vl.c
+++ b/vl.c
@@ -1170,13 +1170,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);