[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/5] memory: check if the total numa memory size is
From: |
Wanlong Gao |
Subject: |
[Qemu-devel] [PATCH 2/5] memory: check if the total numa memory size is equal to ram_size |
Date: |
Thu, 23 May 2013 16:47:19 +0800 |
If the total number of the assigned numa nodes memory is not
equal to the assigned total ram size, the guest will recognize
all memory to one node.
eg:
-m 1024 -smp sockets=2,cores=1,threads=1 -numa node,cpus=0,nodeid=0,mem=512 \
-numa node,nodeid=1,cpus=1,mem=256
(qemu) info numa
2 nodes
node 0 cpus: 0
node 0 size: 512 MB
node 1 cpus: 1
node 1 size: 256 MB
$ numactl -H
avaliable: 1 nodes (0)
node 0 cpus: 0 1
node 0 size: 1023 MB
node 0 free: 821 MB
node distances:
node 0
0: 10
Signed-off-by: Wanlong Gao <address@hidden>
---
vl.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/vl.c b/vl.c
index 59dc0b4..ce24bcd 100644
--- a/vl.c
+++ b/vl.c
@@ -4238,6 +4238,15 @@ int main(int argc, char **argv, char **envp)
node_mem[i] = ram_size - usedmem;
}
+ uint64_t numa_total = 0;
+ for (i = 0; i < nb_numa_nodes; i++)
+ numa_total += node_mem[i];
+ if (numa_total != ram_size) {
+ fprintf(stderr, "qemu: numa nodes total memory size "
+ "should equal ram size\n");
+ exit(1);
+ }
+
for (i = 0; i < nb_numa_nodes; i++) {
if (!bitmap_empty(node_cpumask[i], MAX_CPUMASK_BITS)) {
break;
--
1.8.3.rc2.10.g0c2b1cf