Message ID | 1369298842-6295-2-git-send-email-gaowanlong@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
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;
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 <gaowanlong@cn.fujitsu.com> --- vl.c | 9 +++++++++ 1 file changed, 9 insertions(+)