[PATCH] D58718: [Memory] Add basic support for large/huge memory pages

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 27 11:46:39 PST 2019


zturner added inline comments.


================
Comment at: lib/Support/Windows/Memory.inc:72
+      TP.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+      if (AdjustTokenPrivileges(Token, FALSE, &TP, 0, 0, 0)) {
+        DWORD E = GetLastError();
----------------
zturner wrote:
> Why do we actually even need to set this privilege on the process token?  Will huge pages not work without it?
> 
> Also, it's strange to be doing this from a function called `getLargePageSize` which sounds like it doesn't modify anything.
Actually I found this that explains it:

https://blogs.msdn.microsoft.com/oldnewthing/20110128-00/?p=11643

Is looking up the privilege value and opening the token expensive?  If so, maybe you want to put this behind an `llvm::call_once()`


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58718





More information about the llvm-commits mailing list