From: Olivier Matz Date: Wed, 18 May 2016 11:04:42 +0000 (+0200) Subject: mem: lock pages when not using hugepages X-Git-Tag: spdx-start~6880 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=593a084afc2b441895aeca78a2c4465e450d0ef5;p=dpdk.git mem: lock pages when not using hugepages Although the physical address won't be correct in memory segment, this allows at least to retrieve the physical address using rte_mem_virt2phy(). Indeed, if the page is not locked, the page may not be present in physical memory. With next commit, it allows a mempool to have properly filled physical addresses when using --no-huge option. Signed-off-by: Olivier Matz --- diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 5b9132c672..79d1d2dd80 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1074,7 +1074,7 @@ rte_eal_hugepage_init(void) /* hugetlbfs can be disabled */ if (internal_config.no_hugetlbfs) { addr = mmap(NULL, internal_config.memory, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); + MAP_LOCKED | MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); if (addr == MAP_FAILED) { RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__, strerror(errno));