[PATCH] D71975: [Support] Support MF_HUGE_HINT for Linux and FreeBSD

Bruno Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 29 11:38:26 PST 2019


riccibruno created this revision.
riccibruno added reviewers: bsdjhb, dim, t.p.northover, psmith, rnk.
riccibruno added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya, krytarowski, arichardson, emaste.

Implement support for large page requests with the `allocateMappedMemory` interface on Linux and FreeBSD. If the `MF_HUGE_HINT` flag is passed we first try an `mmap` with the relevant flag. If that fails we fall back to a normal `mmap`. On some systems (such as Linux with transparent huge pages) it is possible to indicate with `madvise` that a certain range of memory should use large pages. We do this if supported and the first `mmap` with the large page flag failed.

Note that only a little test is added since the `allocateMappedMemory` interface is already well-tested. It seems difficult to reliably test that we got large pages. I am open to suggestions here (maybe with `userfaultfd` ?).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71975

Files:
  llvm/include/llvm/Support/Memory.h
  llvm/lib/Support/Unix/Memory.inc
  llvm/unittests/Support/MemoryTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71975.235513.patch
Type: text/x-patch
Size: 6752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191229/b5f6f2ad/attachment.bin>


More information about the llvm-commits mailing list