[PATCH] D96626: Support: mapped_file_region: Pass MAP_NORESERVE to mmap

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 01:33:19 PDT 2021


labath added a comment.

[Disclaimer: I also don't consider myself to be the owner of this code.]

I was thinking whether lldb should even be mapping the entirety of the core file if it knows that a typical session will only access a small fraction of it. I was about to propose some sort of lazy loading scheme for the memory contents, but then I realized that is kind of exactly what we get with mmap.

Are you sure that the lld case is relevant here? If lld using this function to write the output file, then I assume it's passing MAP_SHARED to mmap(2) (i.e., Mode==readwrite to mapped_file_region), as it wants (unlike lldb) the changes to be visible after it is done. I haven't checked the manpage or the linux kernel behavior, but intuitively, I would expect that a shared mapping should not trigger an OOM, because at any point the kernel can decide to flush the dirty pages to disk (that's actually one technique for creating a per-process swap file).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96626/new/

https://reviews.llvm.org/D96626



More information about the llvm-commits mailing list