[PATCH] D71786: RFC: [Support] On Windows, add optional support for rpmalloc

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 07:53:06 PST 2020


aganea updated this revision to Diff 237082.
aganea added a comment.

- Integrated changes as suggested by @russell.gallop - Could you please re-apply the patch on a clean git checkout see if this works?
- Fixed usage of LLVM_RPMALLOC_PAGESIZE -- it seems __attribute__((__unused__)) doesn't always prevent the symbol from being evicted by LLD -- maybe using TLS callbacks is an edge case.  I extended the usage of `/INCLUDE` to Clang, like for MSVC.
- Fixed enabling large pages in rpmalloc, when they are provided in the 'config' struct. Previously, `AdjustTokenPrivileges` wasn't called in this case, and that is required for `VirtualAlloc(MEM_LARGEPAGES, ...)` to work.

---

Along the way, I discovered what looks like a new NT kernel issue in Windows 10 build 1909. Still need to confirm this with Microsoft, but from looking at the profile traces, code in the NT kernel (specific to large pages) seems to take almost 100% CPU time when allocating large pages in many threads.
F11187739: bug_1909_large_pages.PNG <https://reviews.llvm.org/F11187739>
F11187741: bug_1909_large_pages_5.PNG <https://reviews.llvm.org/F11187741>

The problem is not there when running on 1903 (same exact hardware, dual Xeon 6140, but different machine -- using only one CPU socket in these tests):
F11187744: bug_1903_large_pages_6.PNG <https://reviews.llvm.org/F11187744>

As for the link timings with LLD, I see not difference when using large pages (I've tried 2MB and 1GB pages). I would imagine the cache misses are dominant over DTLB misses, but I would need to dig a bit deeper with VTune. Please let me know if you see a difference on your end.


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

https://reviews.llvm.org/D71786

Files:
  llvm/CMakeLists.txt
  llvm/include/llvm/Config/config.h.cmake
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/Windows/Memory.inc
  llvm/lib/Support/rpmalloc/LICENSE
  llvm/lib/Support/rpmalloc/malloc.c
  llvm/lib/Support/rpmalloc/rpmalloc.c
  llvm/lib/Support/rpmalloc/rpmalloc.h
  llvm/tools/llvm-shlib/CMakeLists.txt
  llvm/tools/remarks-shlib/CMakeLists.txt
  llvm/unittests/Support/DynamicLibrary/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71786.237082.patch
Type: text/x-patch
Size: 127672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200109/f42c8eaa/attachment.bin>


More information about the llvm-commits mailing list