On win10, Large Pages only work when
1) Program executable is x64
2) Runs under admin
3) Policy allows large pages (“Computer Configuration” , “Windows Settings”, “Security Settings”, “Local Policies” , “User Rights Assignment”, “Lock Pages in memory”)
4) Unfragmented 2MB pages physically exist in memory manager (ie test is done soon after reboot)
Current PC virtual memory architecture supports different page sizes - 4K,2M,1G; https://en.wikipedia.org/wiki/Page_(...age_table_size
Large pages were added in hardware long after the memory management in popular operating systems was already established,
so large pages are managed separately, and are not allocated automatically by default, eg. just because requested memory block is large enough.
> 1. just shows info
2mpages.cpp attempts to acquire permissions and allocate a memory block using large pages.
It does print error messages for called winapi functions, so it can be said that it "shows info".
2Mlin.cpp is just an example of memory allocation using large pages.
> 2. sets OS to use 2mb pages
That's currently impossible without using non-default OS memory manager.
Linux example shows how to reserve large pages via device FS, so they'd stay reserved until next change.
But even then linux won't automatically use them.
> 3. sets OS to use 2mb pages until reboot?
No, these pages have to be allocated in a special way, so I posted examples on how to do it.