xxxxx@osr.com wrote:
Well… You’re not giving us much to go on here. How and when are
the buffers allocated? How and when are the buffers DEallocated?
How many buffers do you have allocated simultaneously? How many
buffers do you need to allocate on a given system before you get the
error? Is the number always the same?What steps have you taken to debug the problem so far, other than
looking at Performance Monitor and posting here?We’ll be happy to help, I’m sure, but you DO have to give us some
data…
All buffers are allocated in user-mode and their addresses are passed
via IoControl (METHOD_BUFFERED) to my top-level driver. In each call I
pass two buffers of fixed size of about 4k Byte and a variable size
buffer which is usually much bigger.
In my PyNwAgntIoCtrlEvtDeviceIoInCallerContext handler the addresses are
mapped into SystemSpace using following scheme:
- MmInitializeMdl()
- MmProbeAndLockPages()
- MmGetSystemAddressForMdlSafe()
When successful the buffers are fed into an input queue by another
IoControl request, filled by the hardware, retrieved and processed by
the user mode app (for example visualization).
When done resp. the device needs to be reconfigurated the buffers are
detached, saying the handler calls:
- MmUnlockPages()
Then the buffers is returned and deallocated by the user-mode app.
I tried to tracing my calls whether allocation/disallocation was done in
pairs without finding an obvious leak.
I tried to determine a limit have been able to allocate 40 Buffers @ 10
MB each. I repeat this many times without a problem on my test system.
When I do on a system with “workload” it happens that it may start it
once and the next time it doesn’t. The error occurs when
MmGetSystemAddressForMdlSafe() is called. This leads me to assumption
that there might be a problem with Page Table Entries. Are there further
resources that are allocated in that call?
My reasoning is:
- Buffers are allocated i user-mode => can’t fail anymore
- Mdl is created => can’t fail anymore
- Pages are locked in memory => kernel address space was not exhausted
-> something else is missing, but what if not PTE
It is not a desaster that I’m not able to allocate resources for huge
amounts of memory (although I don’t think 400 MB is huge nowadays). But
I would love to know what the limits are on specific system. It would be
ideal if I were able report the amount of available resource prior to
the call to MmGetSystemAddressForMdlSafe().
Any help would be appreciated.
–
Hartmut