From e51976083e6042546b1922e8a00bbb2e86e21423 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Thu, 2 May 2019 10:45:11 -0400 Subject: [PATCH] Disable pre-allocation of 2M hugepages on VBox Slow performance was observed in vbox with the default 2M hugepages allocation. This update disables the default 2M hugepages allocation in vbox. Users are expected to allocate desired huge pages via CLI or Horizon. In addition, the default platform reserved memory has been increased to 2500M on the worker nodes running in vbox. Fixes-Bug: 1825814 Change-Id: I2558bcde76a23f1293e07486dbbe5a4b6f91db2f Signed-off-by: Tao Liu --- .../sysinv/sysinv/api/controllers/v1/host.py | 3 ++- sysinv/sysinv/sysinv/sysinv/common/constants.py | 1 + sysinv/sysinv/sysinv/sysinv/common/utils.py | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py index ee36fd8626..6a896facfe 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py @@ -3690,7 +3690,8 @@ class HostController(rest.RestController): # allocated and the compute label is set if cutils.has_openstack_compute(labels) and \ vm_hugepages_nr_2M == 0 and \ - vm_hugepages_nr_1G == 0: + vm_hugepages_nr_1G == 0 and \ + cutils.is_default_huge_pages_required(ihost): vm_hugepages_nr_2M = m.vm_hugepages_possible_2M * 0.9 value.update({'vm_hugepages_nr_2M': vm_hugepages_nr_2M}) diff --git a/sysinv/sysinv/sysinv/sysinv/common/constants.py b/sysinv/sysinv/sysinv/sysinv/common/constants.py index af63116c2c..60f566117e 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/constants.py +++ b/sysinv/sysinv/sysinv/sysinv/common/constants.py @@ -218,6 +218,7 @@ DISK_IO_RESIDENT_SET_SIZE_MIB_VBOX = 500 # Memory reserved for platform core in MiB per host PLATFORM_CORE_MEMORY_RESERVED_MIB = 2000 PLATFORM_CORE_MEMORY_RESERVED_MIB_VBOX = 1100 +PLATFORM_CORE_MEMORY_RESERVED_MIB_VBOX_WORKER = 2000 # For combined node, memory reserved for controller in MiB COMBINED_NODE_CONTROLLER_MEMORY_RESERVED_MIB = 10500 diff --git a/sysinv/sysinv/sysinv/sysinv/common/utils.py b/sysinv/sysinv/sysinv/sysinv/common/utils.py index e5db4b0d04..f554b60454 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/utils.py +++ b/sysinv/sysinv/sysinv/sysinv/common/utils.py @@ -960,8 +960,12 @@ def get_required_platform_reserved_memory(ihost, numa_node, low_core=False): required_reserved += constants.DISK_IO_RESIDENT_SET_SIZE_MIB_VBOX if host_has_function(ihost, constants.WORKER): if numa_node == 0: - required_reserved += \ - constants.PLATFORM_CORE_MEMORY_RESERVED_MIB_VBOX + if ihost['personality'] == constants.WORKER: + required_reserved += \ + constants.PLATFORM_CORE_MEMORY_RESERVED_MIB_VBOX_WORKER + else: + required_reserved += \ + constants.PLATFORM_CORE_MEMORY_RESERVED_MIB_VBOX if host_has_function(ihost, constants.CONTROLLER): required_reserved += \ constants.COMBINED_NODE_CONTROLLER_MEMORY_RESERVED_MIB_VBOX @@ -1974,3 +1978,11 @@ def recur_update(orig_dict, new_dict): else: orig_dict[key] = new_dict[key] return orig_dict + + +def is_default_huge_pages_required(host): + if not host_has_function(host, constants.WORKER): + return False + if is_virtual() or is_virtual_worker(host): + return False + return True