summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kobza <skobza@cisco.com>2016-03-11 15:18:42 +0100
committerGerrit Code Review <gerrit@fd.io>2016-03-14 03:50:11 +0000
commitac26da5b53e352850236fb73c60bd2b9c162eb06 (patch)
tree64c0e29a2ac64a9ec8263781afe19b287abea02a
parenta5584254fca2d3cbb30a8a7912fa60e363b10a4d (diff)
Do not use hugepages if none are available.
In case socket-mem was set to <1024 and no 1G page long hupepages were available, the condition was evaluated in unexpected manner. In other words use_1g == 1, and that fails later in mount(). This patch makes sure this is prevented - if there are no pages_available, do not even try to use that pagesize. Change-Id: I30675aa017d97b99d84d5db926e62f0acb54deb6 Signed-off-by: Stefan Kobza <skobza@cisco.com>
-rw-r--r--vnet/vnet/devices/dpdk/init.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index bcfaf25750a..47b5153d00c 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -1148,11 +1148,11 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
u32 pages_avail;
pages_avail = get_node_free_hugepages_num(c, 1048576);
- if (!(pages_avail >= pages_num_1g))
+ if (!pages_avail || !(pages_avail >= pages_num_1g))
use_1g = 0;
pages_avail = get_node_free_hugepages_num(c, 2048);
- if (!(pages_avail >= pages_num_2m))
+ if (!pages_avail || !(pages_avail >= pages_num_2m))
use_2m = 0;
}
}