From 1c7a9fdfa6078494ec9c71931da6cd0df9180fd6 Mon Sep 17 00:00:00 2001 From: "Mytnyk, Volodymyr" Date: Wed, 21 Nov 2018 17:00:51 +0000 Subject: Fix hugepages calculation JIRA: YARDSTICK-1537 Change-Id: If4e78fe49c8b248c180d5a8db3932d822b9e5f95 Signed-off-by: Mytnyk, Volodymyr --- yardstick/common/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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() -- cgit 1.2.3-korg