summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolodymyr Mytnyk <volodymyrx.mytnyk@intel.com>2018-11-22 12:04:44 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-11-22 12:04:44 +0000
commit4f28b17a287277258fe6739c5a9a04dec23346f6 (patch)
treea565a94217f854a5dacaa76adf34871a57c42991
parent289006de6407e1fdb285232bdccd995de2e182c6 (diff)
parent1c7a9fdfa6078494ec9c71931da6cd0df9180fd6 (diff)
Merge "Fix hugepages calculation"
-rw-r--r--yardstick/common/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index 205247947..51313ef47 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -30,6 +30,7 @@ import subprocess
import sys
import time
import threading
+import math
import six
from flask import jsonify
@@ -505,7 +506,7 @@ def setup_hugepages(ssh_client, size_kb):
NR_HUGEPAGES_PATH = '/proc/sys/vm/nr_hugepages'
meminfo = read_meminfo(ssh_client)
hp_size_kb = int(meminfo['Hugepagesize'])
- hp_number = int(abs(size_kb / hp_size_kb))
+ hp_number = int(math.ceil(size_kb / float(hp_size_kb)))
ssh_client.execute(
'echo %s | sudo tee %s' % (hp_number, NR_HUGEPAGES_PATH))
hp = six.BytesIO()