eal/ppc: fix mmap for memory initialization
On IBM POWER platform, when mapping /dev/zero file to hugepage memory space, mmap will not respect the requested address hint. This will cause the memory initialization for the second process fails. This patch adds the required mmap flags to make it work. Beside this, users need to set the nr_overcommit_hugepages to expand the VA range. When doing the initialization, users need to set both nr_hugepages and nr_overcommit_hugepages to the same value, like 64, 128, etc. Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> Acked-by: John McNamara <john.mcnamara@intel.com>
This commit is contained in:
parent
2fc8e0bf04
commit
284ae3e9ff
@ -200,6 +200,12 @@ On a NUMA machine, pages should be allocated explicitly on separate nodes::
|
||||
|
||||
For 1G pages, it is not possible to reserve the hugepage memory after the system has booted.
|
||||
|
||||
On IBM POWER system, the nr_overcommit_hugepages should be set to the same value as nr_hugepages.
|
||||
For example, if the required page number is 128, the following commands are used::
|
||||
|
||||
echo 128 > /sys/kernel/mm/hugepages/hugepages-16384kB/nr_hugepages
|
||||
echo 128 > /sys/kernel/mm/hugepages/hugepages-16384kB/nr_overcommit_hugepages
|
||||
|
||||
Using Hugepages with the DPDK
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -331,7 +331,13 @@ get_virtual_area(size_t *size, size_t hugepage_sz)
|
||||
}
|
||||
do {
|
||||
addr = mmap(addr,
|
||||
(*size) + hugepage_sz, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
(*size) + hugepage_sz, PROT_READ,
|
||||
#ifdef RTE_ARCH_PPC_64
|
||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB,
|
||||
#else
|
||||
MAP_PRIVATE,
|
||||
#endif
|
||||
fd, 0);
|
||||
if (addr == MAP_FAILED)
|
||||
*size -= hugepage_sz;
|
||||
} while (addr == MAP_FAILED && *size > 0);
|
||||
@ -1359,7 +1365,13 @@ rte_eal_hugepage_attach(void)
|
||||
* use mmap to get identical addresses as the primary process.
|
||||
*/
|
||||
base_addr = mmap(mcfg->memseg[s].addr, mcfg->memseg[s].len,
|
||||
PROT_READ, MAP_PRIVATE, fd_zero, 0);
|
||||
PROT_READ,
|
||||
#ifdef RTE_ARCH_PPC_64
|
||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB,
|
||||
#else
|
||||
MAP_PRIVATE,
|
||||
#endif
|
||||
fd_zero, 0);
|
||||
if (base_addr == MAP_FAILED ||
|
||||
base_addr != mcfg->memseg[s].addr) {
|
||||
max_seg = s;
|
||||
|
Loading…
x
Reference in New Issue
Block a user