elf2dmp: use Linux mmap with MAP_NORESERVE when possible
commitdf7a75564e72b61213d5355c9ba8215244bb83bd
authorViktor Prutyanov <viktor@daynix.com>
Fri, 15 Sep 2023 17:01:52 +0000 (15 20:01 +0300)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 21 Sep 2023 15:13:54 +0000 (21 16:13 +0100)
tree0f78c38cd181f97cb1ad5988f9c5197279ce2ffb
parent9b7dcd8ff4e5a0b6a976027f6d78c0b55c30607d
elf2dmp: use Linux mmap with MAP_NORESERVE when possible

Glib's g_mapped_file_new maps file with PROT_READ|PROT_WRITE and
MAP_PRIVATE. This leads to premature physical memory allocation of dump
file size on Linux hosts and may fail. On Linux, mapping the file with
MAP_NORESERVE limits the allocation by available memory.

Signed-off-by: Viktor Prutyanov <viktor@daynix.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-id: 20230915170153.10959-5-viktor@daynix.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
contrib/elf2dmp/qemu_elf.c
contrib/elf2dmp/qemu_elf.h