From: David Marchand Date: Mon, 9 Mar 2020 14:54:42 +0000 (+0100) Subject: mem: mark pages as not accessed when reserving VA X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8a4baf06c17a806696fb10aba36fce7471983028;p=dpdk.git mem: mark pages as not accessed when reserving VA When the memory allocator reserves virtual addresses, it still does not know what they will be used for. Besides, huge areas are reserved for memory hotplug in multiprocess setups. But most of the pages are unused in the whole life of the processes. Change protection mode to PROT_NONE when only reserving VA. The memory allocator already switches to the right mode when making use of it. It also has the nice effect of getting those pages skipped by the kernel when calling mlockall() or when a coredump gets generated. Cc: stable@dpdk.org Suggested-by: Andrea Arcangeli Signed-off-by: David Marchand Reviewed-by: Maxime Coquelin Acked-by: Aaron Conole Acked-by: Anatoly Burakov --- diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c index 4a9cc1f19a..cc7d54e0c7 100644 --- a/lib/librte_eal/common/eal_common_memory.c +++ b/lib/librte_eal/common/eal_common_memory.c @@ -97,7 +97,7 @@ eal_get_virtual_area(void *requested_addr, size_t *size, return NULL; } - mapped_addr = mmap(requested_addr, (size_t)map_sz, PROT_READ, + mapped_addr = mmap(requested_addr, (size_t)map_sz, PROT_NONE, mmap_flags, -1, 0); if (mapped_addr == MAP_FAILED && allow_shrink) *size -= page_sz;