!sysptes not working (Was: pte leak and MmGetSystemAddressForMdlSafe)

> how do you *know* that you have a pte leak problem?

The “Free system page table entries” counter in perfmon continually drops
(100,000 -> 5,000) until the system goes haywire. This is only while my
backup code (.net 2.0 app and driver) is running. The microsoft docs I’ve
found says that it is usually a driver’s fault.

I changed my architecture so I was only writing 100,000 files instead of a
million and this helped a lot, but the leak is still there and causing
problems.

I found instructions for using “!sysptes 4” in kd, which is supposed to tell
pte usage per driver, but that command is not working for me. I’m getting
the error “Unable to get System PTE lock consumer information”. I set
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory
Management\TrackPtes to 1 and rebooted as per the instructions.

Does anyone have any experience with !sysptes?

“Lyndon J Clarke” wrote in message
news:xxxxx@ntfsd…
> Mark
>
> You say you have a pte leak problem but … well perhaps and perhaps not
> … how do you know that you have a pte leak problem?
>
> Cheers
> Lyndon
>
> “Mark Hahn” wrote in message news:xxxxx@ntfsd…
>>I have a PTE leak problem. I’m developing a mini-filter that has the code
>>below in the pre-write callback. The problem shows up when a user-app
>>does a lot of writes, but I suspect the leak is always there but small. I
>>doubt the leak comes from the user-app.
>>
>> Am I missing code to release a pte created by the
>> MmGetSystemAddressForMdlSafe call? I assume MmGetSystemAddressForMdlSafe
>> creates a PTE and I wonder how that PTE is expected to go away later.
>>
>> Any help would be greatly appreciated…
>>
>> <---- mini-filter pre-write callback code snippet ---->
>>
>> if ( Data->Iopb->Parameters.Write.MdlAddress != NULL ) {
>> buffer = ( Data->Iopb->Parameters.Write.MdlAddress,
>> NormalPagePriority );
>> if ( buffer == NULL ) {
>> CpsPrint( “Unable to get sys addr in pre-write”);
>> goto err;
>> }
>> } else
>> buffer = Data->Iopb->Parameters.Write.WriteBuffer;
>> __try {
>> RtlCopyMemory( pRec->Data, buffer, dataSize );
>> }__except ( EXCEPTION_EXECUTE_HANDLER ) {
>> CpsPrint( “Exception while copying data buffer in pre-write” );
>> goto err;
>> }
>>
>>
>
>
>