mem: do not unmap overlapping region on mmap failure
authorDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Fri, 1 Jun 2018 12:59:20 +0000 (14:59 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 12 Jul 2018 22:25:07 +0000 (00:25 +0200)
commit0762c438b8da8486b283f4da0c01a85f684b8896
tree07c756be9cbe4f08e75d3f812ae9a2085d963395
parent637175ab95ed1dad3790a3c565fe8eaf422aa2c3
mem: do not unmap overlapping region on mmap failure

This isn't documented in the manuals, but a failed
mmap(..., MAP_FIXED) may still unmap overlapping
regions. In such case, we need to remap these regions
back into our address space to ensure mem contiguity.
We do it unconditionally now on mmap failure just to
be safe.

Verified on Linux 4.9.0-4-amd64. I was getting
ENOMEM when trying to map hugetlbfs with no space
left, and the previous anonymous mapping was still
being removed.

Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/linuxapp/eal/eal_memalloc.c