Huge Pages Are a Good Idea
evanjones.ca
evanjones.ca
Why can't free memory automatically be converted to huge pages when I call mmap(HUGE_TLB)?
They need special security privilege SeLockMemoryPrivilege, since vista introduced UAC most processes don't have that privilege.
Windows is unwilling to page large pages to disk, easy to fail with out of memory errors. I don't think there's a good reason for that: it's much faster to load 2MB from disk on modern computer, then it was to load 4kb from disk on i386.
"Transparent huge pages" is (sort of) the feature you ask for. It is very restricted in what it will do because of early mistakes pegging CPUs scanning for opportunities.
"The memory is always read/write and nonpageable (always resident in physical memory)."
To say nothing of the fact that you have to do a privilege change to even access the API.
[1] https://learn.microsoft.com/en-us/windows/win32/memory/large...