PFN entry share count vs. reference count

Locking user pages does bring them into the working set but that’s an implementation detail (and the pages can be trimmed again as soon as MmProbeAndLockPages returns). Remember that MmProbeAndLockPages only increments the reference count; it doesn’t place any restrictions on the share count.

Anyway, this is not relevant for the question Alex asked. The answer to that question is that MDL mappings (in user or system space) are not part of any working set, and therefore don’t affect the share count. Working sets keep track of pageable memory; MDL mappings are non-pageable so there is no point in adding them to the working set.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of George M. Garner Jr.
Sent: Tuesday, March 5, 2013 3:59 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] PFN entry share count vs. reference count

On 3/5/2013 5:48 PM, xxxxx@videotron.ca wrote:

Pavel, that was pretty much my simple explanation as well, but it doesn’t really seem to be accurate because non-PPTE based user-mapped pages of the same PFN (such as ProbeAndLock) increment RefCount, not ShareCount, as in Carlo’s example earlier. Or is it that those user-mapped pages are not in the WS?


Best regards,
Alex Ionescu

Locking the user pages brings them into the WS if they were not already there. (I am assuming that “WS” stands for “workingset.”)

1 Like