aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-10-24 12:56:32 +0200
committerDave Barach <openvpp@barachs.net>2018-10-24 13:26:41 +0000
commit9787f5f90a6802e39fa7954c344ba89b03a6c4af (patch)
tree0035506066ab4cadec411fc19d8af6f3f5481705 /src/plugins
parenta35fc46c0ae6e6d21b35413bdc993171265fd4e5 (diff)
vppinfra: autodetect default hugepage size
Change-Id: I5ff713ad0b254c74c5622e3b9425cca365b5ee97 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/device/init.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 6553fca77ec..b9b3b15f2dc 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1284,15 +1284,17 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
/* *INDENT-ON* */
}
+ uword default_hugepage_sz = clib_mem_get_default_hugepage_size ();
/* *INDENT-OFF* */
clib_bitmap_foreach (c, tm->cpu_socket_bitmap, (
{
clib_error_t *e;
-
+ uword n_pages;
vec_validate(mem_by_socket, c);
+ n_pages = round_pow2 (mem_by_socket[c], default_hugepage_sz);
+ n_pages /= default_hugepage_sz;
- e = clib_sysfs_prealloc_hugepages(c, 0, mem_by_socket[c] / 2);
- if (e)
+ if ((e = clib_sysfs_prealloc_hugepages(c, 0, n_pages)))
clib_error_report (e);
}));
/* *INDENT-ON* */