Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add the --numa option to create custom NUMA nodes inside the guest and assign virtual CPUs to them.
Syntax:
--numa MEM[,cpus=FIRST_CPU1[-LAST_CPU1]][,cpus=FIRST_CPU2[-LAST_CPU2]]...
Examples:
a simple one with 2 NUMA nodes of 2G each:
$ vng -r -m 4G --numa 2G --numa 2G -- numactl -H
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 6 7
node 0 size: 1971 MB
node 0 free: 1779 MB
node 1 cpus:
node 1 size: 1950 MB
node 1 free: 1924 MB
node distances:
node 0 1
0: 10 20
1: 20 10
a more complex one, with a 1GB node and 3GB node, each one with a different non-contiguous set of CPUs assigned:
$ vng -r -m 4G --numa 1G,cpus=0-1,cpus=3 --numa 3G,cpus=2,cpus=4-7 -- numactl -H
available: 2 nodes (0-1)
node 0 cpus: 0 1 3
node 0 size: 1005 MB
node 0 free: 912 MB
node 1 cpus: 2 4 5 6 7
node 1 size: 2916 MB
node 1 free: 2760 MB
node distances:
node 0 1
0: 10 20
1: 20 10
Keep in mind that using --numa automatically disables the microvm architecture (that doesn't expose NUMA information).
Also note that virtiofsd requires a memory backed NUMA node, so if some custom NUMA nodes are created virtiofs will use the first one of them, otherwise it will create a single NUMA node that maps all the memory (that was the previous behavior).
But this allows to use --numa and enable virtiofsd at the same time.
This implements the request from issue #56.