mem: exclude unused memory from core dump
authorLi Feng <fengli@smartx.com>
Fri, 24 Apr 2020 13:19:05 +0000 (21:19 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 24 Apr 2020 17:36:17 +0000 (19:36 +0200)
commitd72e4042c5ebda7af81448b387af8218136402d0
tree1f30f7f78fc67f18a611af86bd770cd0f8e048c2
parent76e91e3f14fc13f31608167d698682790be45cba
mem: exclude unused memory from core dump

Currently, even though memory is mapped with PROT_NONE, this does not
cause it to be excluded from core dumps. This is counter-productive,
because in a lot of cases, this memory will go unused (e.g. when the
memory subsystem preallocates VA space but hasn't yet mapped physical
pages into it).

Use `madvise()` call with MADV_DONTDUMP/MADV_NOCORE to exclude the
unused memory from being dumped.

Signed-off-by: Li Feng <fengli@smartx.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/common/eal_common_memory.c
lib/librte_eal/linux/eal_memalloc.c