There is an important reason for this restriction: large pages are not pageable. Think about it. You have some page file(s) full of 4k chunks with lots of data in them. Assume for efficiency that you manage the data in these files with some kind of bitmap ? like say the Windows team has done ? and then say now a want a 2 MB chunk to page out this large page I have been working on. Clearly it doesn?t work.
The ?obvious? solution is to say that large pages are chiefly used in limited situations such as mapping kernel32.dll or by ?advanced? users who have lots of RAM and full control over there systems and therefore it is okay to just make then not pageable. Once you have arrived at this conclusion it is not hard to see how the need for the lock pages in memory privilege becomes the next requirement.
IIRC Anton is wrong however in that this privilege is granted (but not enabled) for administrators by default. This has changed from Windows version to version and it has been a long time since I worked outside of a GPO controlled environment so I might have this mistaken
Any properly written code that tries to use large pages as a performance optimization can fail back to an successfully use normal pages. That?s what they are, a performance optimization for reducing the TLB lookup cost. Any other use is nonsense.
Sent from Mailhttps: for Windows 10
________________________________
From: xxxxx@lists.osr.com on behalf of xxxxx@osr.com
Sent: Friday, August 31, 2018 3:37:32 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How to get physical pages from user space for DMA transaction.
Well, I learned something today.
Despite the docs you pointed to being very clear, a blog post by Raymond Chen (I mean, what does HE know, right?), and numerous articles on SO… I couldn’t believe it. So, I worked super hard and wrote my own program (OK, not really, I copied 90% of it from somebody somewhere):
int rc, min;
min = GetLargePageMinimum();
void *p = VirtualAlloc(NULL,
min,
MEM_COMMIT | MEM_RESERVE | MEM_LARGE_PAGES,
PAGE_READWRITE);
rc = GetLastError();
printf(“Pointer = %p, Error = %d.\n”, p, rc);
You know what? Error = 1314 – “A required privilege is not held”… I’ll be darned.
Gotta keep those pesky user-mode programmers under control, I guess! Can’t have them allocating LARGE PAGES. OMG!
Thanks Anton. I hereby grant you a free pass to make one rude, crude, arrogant, and socially irresponsible post here on NTDEV without being banned for life.
Peter
OSR
@OSRDrivers
—
NTDEV is sponsored by OSR
Visit the list online at: http:
MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:
To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></https:>