X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=lib%2Flibrte_eal%2Flinuxapp%2Feal%2Feal_memory.c;h=8d0456b56011bb48d966c7040481a3f11860fac5;hb=597cb1874068054d4c0be41f161a72ef37888930;hp=bac969a1285a1cb6f51b45a79fb26a9ab2583b02;hpb=6e7cbd63706f3435b9d9a2057a37db1da01db9a7;p=deb_dpdk.git diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index bac969a1..8d0456b5 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -396,7 +396,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, int node_id = -1; int essential_prev = 0; int oldpolicy; - struct bitmask *oldmask = numa_allocate_nodemask(); + struct bitmask *oldmask = NULL; bool have_numa = true; unsigned long maxnode = 0; @@ -408,6 +408,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, if (orig && have_numa) { RTE_LOG(DEBUG, EAL, "Trying to obtain current memory policy.\n"); + oldmask = numa_allocate_nodemask(); if (get_mempolicy(&oldpolicy, oldmask->maskp, oldmask->size + 1, 0, 0) < 0) { RTE_LOG(ERR, EAL, @@ -421,6 +422,21 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, } #endif +#ifdef RTE_ARCH_64 + /* + * Hugepages are first mmaped individually and then re-mmapped to + * another region for having contiguous physical pages in contiguous + * virtual addresses. Setting here vma_addr for the first hugepage + * mapped to a virtual address which will not collide with the second + * mmaping later. The next hugepages will use increments of this + * initial address. + * + * The final virtual address will be based on baseaddr which is + * 0x100000000. We use a hint here starting at 0x200000000, leaving + * another 4GB just in case, plus the total available hugepages memory. + */ + vma_addr = (char *)0x200000000 + (hpi->hugepage_sz * hpi->num_pages[0]); +#endif for (i = 0; i < hpi->num_pages[0]; i++) { uint64_t hugepage_sz = hpi->hugepage_sz; @@ -588,7 +604,8 @@ out: numa_set_localalloc(); } } - numa_free_cpumask(oldmask); + if (oldmask != NULL) + numa_free_cpumask(oldmask); #endif return i; }