summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/pmalloc.c
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/vppinfra/pmalloc.c
parenta35fc46c0ae6e6d21b35413bdc993171265fd4e5 (diff)
vppinfra: autodetect default hugepage size
Change-Id: I5ff713ad0b254c74c5622e3b9425cca365b5ee97 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/pmalloc.c')
-rw-r--r--src/vppinfra/pmalloc.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c
index 0f9df9c6641..a8b47d74c9b 100644
--- a/src/vppinfra/pmalloc.c
+++ b/src/vppinfra/pmalloc.c
@@ -55,26 +55,12 @@ pmalloc_validate_numa_node (u32 * numa_node)
int
clib_pmalloc_init (clib_pmalloc_main_t * pm, uword size)
{
- struct stat st;
uword off, pagesize;
- int fd;
ASSERT (pm->error == 0);
- pm->log2_page_sz = 21;
- pm->error = clib_mem_create_hugetlb_fd ("detect_hugepage_size", &fd);
-
- if (pm->error)
- return -1;
-
- if (fd != -1)
- {
- if (fstat (fd, &st) == -1)
- pm->log2_page_sz = min_log2 (st.st_blksize);
- close (fd);
- }
-
- pagesize = 1ULL << pm->log2_page_sz;
+ pagesize = clib_mem_get_default_hugepage_size ();
+ pm->log2_page_sz = min_log2 (pagesize);
size = size ? size : ((u64) DEFAULT_RESERVED_MB) << 20;
size = round_pow2 (size, pagesize);