Skip to contentSkip to conversation

Don't limit node count by smp count

PATCH Superseded Sasha Levin 3 participants 4 messages Mar 30, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't limit node count by smp count

It is possible to create CPU-less NUMA nodes, node amount shouldn't be limited by amount of CPUs.

---
 vl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
vl.c +2 -2
index 8bcf2ae..8cc1aa8 100644
@@ -3002,8 +3002,8 @@ int main(int argc, char **argv, char **envp)
     if (nb_numa_nodes > 0) {
         int i;
 
-        if (nb_numa_nodes > smp_cpus) {
-            nb_numa_nodes = smp_cpus;
+        if (nb_numa_nodes > MAX_NODES) {
+            nb_numa_nodes = MAX_NODES;
         }
 
         /* If no memory size if given for any node, assume the default

case

#1 lore raw
Quoted 2 lines · Sasha Levin

It is possible to create CPU-less NUMA nodes, node amount shouldn't be limited by amount of CPUs.

But does this actually work in the code today and does it work with any guests?

Regards,

Anthony Liguori

Quoted 23 lines
---
  vl.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
vl.c +2 -2
index 8bcf2ae..8cc1aa8 100644
@@ -3002,8 +3002,8 @@ int main(int argc, char **argv, char **envp)
      if (nb_numa_nodes>  0) {
          int i;
 
-        if (nb_numa_nodes>  smp_cpus) {
-            nb_numa_nodes = smp_cpus;
+        if (nb_numa_nodes>  MAX_NODES) {
+            nb_numa_nodes = MAX_NODES;
          }
 
          /* If no memory size if given for any node, assume the default

case

#2 lore raw
Quoted 7 lines · Anthony Liguori
Quoted 2 lines · Sasha Levin

It is possible to create CPU-less NUMA nodes, node amount shouldn't be limited by amount of CPUs.

But does this actually work in the code today and does it work with any guests?

I've tested it on an Ubuntu desktop as a guest and it worked fine, /sys/devices/system/node/has_cpu was as expected.

Quoted 28 lines

Regards,

Anthony Liguori

Quoted 23 lines
---
  vl.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
vl.c +2 -2
index 8bcf2ae..8cc1aa8 100644
@@ -3002,8 +3002,8 @@ int main(int argc, char **argv, char **envp)
      if (nb_numa_nodes>  0) {
          int i;
 
-        if (nb_numa_nodes>  smp_cpus) {
-            nb_numa_nodes = smp_cpus;
+        if (nb_numa_nodes>  MAX_NODES) {
+            nb_numa_nodes = MAX_NODES;
          }
 
          /* If no memory size if given for any node, assume the default

case

Signature · 1 line
Sasha.
#3 lore raw
In reply to Sasha Levin
Quoted 23 lines · Sasha Levin

It is possible to create CPU-less NUMA nodes, node amount shouldn't be limited by amount of CPUs.

---
  vl.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
vl.c +2 -2
index 8bcf2ae..8cc1aa8 100644
@@ -3002,8 +3002,8 @@ int main(int argc, char **argv, char **envp)
      if (nb_numa_nodes>  0) {
          int i;
 
-        if (nb_numa_nodes>  smp_cpus) {
-            nb_numa_nodes = smp_cpus;
+        if (nb_numa_nodes>  MAX_NODES) {
+            nb_numa_nodes = MAX_NODES;
          }
 
          /* If no memory size if given for any node, assume the default
Quoted 3 lines

case

Did a quick test myself and it seems to work from what I can tell:

RHEL6 64-bit guest, QEMU master:

/home/mdroth/dev/kvm/qemu.git/x86_64-softmmu/qemu-system-x86_64 -smp 2 -numa node,nodeid=1 -numa node,nodeid=2 -numa node,nodeid=3 -drive file=/home/mdroth/vm/rhel6_64_base.raw,snapshot=off,if=virtio -bios /home/mdroth/dev/kvm/qemu.git/pc-bios/bios.bin -vnc :1 -m 1024 --enable-kvm

...

[mdroth@vm0 ~]$ cat /sys/devices/system/node/node{0,1,2}/cpulist 0
1

[mdroth@vm0 ~]$ cat /sys/devices/system/node/node{0,1,2}/distance 10 20 20
20 10 20
20 20 10
[mdroth@vm0 ~]$ cat /sys/devices/system/node/node{0,1,2}/meminfo

Node 0 MemTotal:         343664 kB
Node 0 MemFree:          181384 kB
Node 0 MemUsed:          162280 kB
Node 0 Active:            26640 kB
Node 0 Inactive:          52752 kB
Node 0 Active(anon):      12272 kB
Node 0 Inactive(anon):        0 kB
Node 0 Active(file):      14368 kB
Node 0 Inactive(file):    52752 kB
Node 0 Unevictable:           0 kB
Node 0 Mlocked:               0 kB
Node 0 Dirty:               116 kB
Node 0 Writeback:             0 kB
Node 0 FilePages:         67220 kB
Node 0 Mapped:            12980 kB
Node 0 AnonPages:         12168 kB
Node 0 Shmem:               104 kB
Node 0 KernelStack:         736 kB
Node 0 PageTables:         2988 kB
Node 0 NFS_Unstable:          0 kB
Node 0 Bounce:                0 kB
Node 0 WritebackTmp:          0 kB
Node 0 Slab:              53356 kB
Node 0 SReclaimable:       8896 kB
Node 0 SUnreclaim:        44460 kB
Node 0 HugePages_Total:     0
Node 0 HugePages_Free:      0
Node 0 HugePages_Surp:      0
Node 1 MemTotal:         344064 kB
Node 1 MemFree:          292756 kB
Node 1 MemUsed:           51308 kB
Node 1 Active:            12548 kB
Node 1 Inactive:          11296 kB
Node 1 Active(anon):       8120 kB
Node 1 Inactive(anon):        4 kB
Node 1 Active(file):       4428 kB
Node 1 Inactive(file):    11292 kB
Node 1 Unevictable:           0 kB
Node 1 Mlocked:               0 kB
Node 1 Dirty:                 4 kB
Node 1 Writeback:             0 kB
Node 1 FilePages:         15776 kB
Node 1 Mapped:             3548 kB
Node 1 AnonPages:          6044 kB
Node 1 Shmem:                56 kB
Node 1 KernelStack:         264 kB
Node 1 PageTables:         1904 kB
Node 1 NFS_Unstable:          0 kB
Node 1 Bounce:                0 kB
Node 1 WritebackTmp:          0 kB
Node 1 Slab:              14696 kB
Node 1 SReclaimable:       1584 kB
Node 1 SUnreclaim:        13112 kB
Node 1 HugePages_Total:     0
Node 1 HugePages_Free:      0
Node 1 HugePages_Surp:      0
Node 2 MemTotal:         360436 kB
Node 2 MemFree:          345112 kB
Node 2 MemUsed:           15324 kB
Node 2 Active:                0 kB
Node 2 Inactive:              0 kB
Node 2 Active(anon):          0 kB
Node 2 Inactive(anon):        0 kB
Node 2 Active(file):          0 kB
Node 2 Inactive(file):        0 kB
Node 2 Unevictable:           0 kB
Node 2 Mlocked:               0 kB
Node 2 Dirty:                 0 kB
Node 2 Writeback:             0 kB
Node 2 FilePages:             0 kB
Node 2 Mapped:                4 kB
Node 2 AnonPages:             0 kB
Node 2 Shmem:                 0 kB
Node 2 KernelStack:           8 kB
Node 2 PageTables:            0 kB
Node 2 NFS_Unstable:          0 kB
Node 2 Bounce:                0 kB
Node 2 WritebackTmp:          0 kB
Node 2 Slab:              10920 kB
Node 2 SReclaimable:       1200 kB
Node 2 SUnreclaim:         9720 kB
Node 2 HugePages_Total:     0
Node 2 HugePages_Free:      0
Node 2 HugePages_Surp:      0

[mdroth@vm0 ~]$