F #4089: Add NUMA policies (#4589)

This commit is contained in:
Christian González authored and GitHub committed 2020-04-24 10:20:00 +02:00
1 parent f97f9037df
commit b3795a470f
2 files changed
+25 -1

No files matched your search

@@ -58,3 +58,12 @@
#
# Timeout to wait a cgroup to be empty after shutdown/cancel a microVM
:cgroup_delete_timeout: 60
################################################################################
# NUMA placement Options
################################################################################
#
# Policy to schedule microVMs accross NUMA nodes. Available options:
# - "rr": schedule the microVMs in a RR way across NUMA nodes based on the VM id.
# - "random": schedule the microVMs randomly across NUMA nodes.
:numa_policy: 'random'
@@ -32,7 +32,8 @@ class FirecrackerConfiguration < Hash
:gid => 9869,
:shutdown_timeout => 10,
:cgroup_location => '/sys/fs/cgroup',
:cgroup_delete_timeout => 10
:cgroup_delete_timeout => 10,
:numa_policy => 'random'
}
FIRECRACKERRC = '../../etc/vmm/firecracker/firecrackerrc'
@@ -258,9 +259,23 @@ class OpenNebulaVM
nodes = nodes.split("\n")
case @fcrc[:numa_policy].downcase
when 'rr'
rr_policy(nodes)
when 'random'
random_policy(nodes)
else
random_policy(nodes)
end
end
def rr_policy(nodes)
Integer(nodes[@vm_id % nodes.size].gsub('node', ''))
end
def random_policy(nodes)
Integer(nodes.sample.gsub('node', ''))
end
#---------------------------------------------------------------------------
# Container Mapping: Extra Configuration & Profiles
#---------------------------------------------------------------------------