Re: MmGetSystemAddressForMdlSafe



Why are you calling it with priority set to High? Is the entire system going to grind to a halt if you don't have your memory?

The function can fail when there's not enough kernel address space avaialble to map the buffer. If the buffer is huge this is going to be very likely. If it's small but KVA is fragmented or you're running with 3GB user-mode address spaces then this is also likely.

MDLs always describe locked memory ranges - if you have one you don't need to lock it. Likewise you don't need to unlock it once you're done with the mapping.

If you want to make forward progress in the face of low resources look at MmAllocateMappingAddress. If you can work on the buffer a little at a time then you should allocate a few pages for reserves & then chunk through the request bit by bit. If you can't then you'll need to pick an arbitrary maximum buffer that you guarantee will work even if resources are low & suggest you clients keep to that if they can't handle errors.

-p

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Michael" <micbarca@xxxxxxxxxxx> wrote in message news:1152614267.065784.257740@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi

We are using MmGetSystemAddressForMdlSafe function to convert address
from user space to kernel space, we call it with priority parameter set
to High.

When we call this function is sometimes fails and returns NULL.

What can be the reason for this function to fail?

Do i need to lock and MDL before calling this function?

Do i need to unlock the MDL after calling this function?

Is there any other way to convert user mode address to kernel mode
address?

Thanks,
Michael


.



Relevant Pages

  • Re: Memory Cleanup
    ... Calling GC.Collect is not the ... // The total memory has not gone down. ... reference counters, and nothing happens when objects go out of scope. ... objects just remain in memory waiting for the garbage collector to remove ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# System.String Memory Usage [TCP IP Connections]
    ... If you're getting 5x the TCPIP performance by calling GC.Collect, ... suffering very badly from heap fragmentation due to all the pinning that's ... call "GC.Collect" is just before you're forced to grow your buffer pool. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: C# System.String Memory Usage [TCP IP Connections]
    ... If you're getting 5x the TCPIP performance by calling GC.Collect, ... suffering very badly from heap fragmentation due to all the pinning that's ... "GC.Collect" is just before you're forced to grow your buffer pool. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Calling waveOut functions from Visual C++ 2005?
    ... you do have to be very careful with who is calling which of those functions. ... waveOutPrepareHeader ... The problem is that when the wave file ... I am allocating memory for the wave samples using the C native malloc ...
    (microsoft.public.win32.programmer.mmedia)
  • exe$alononpage and exe$deanopgdsiz
    ... you can when it comes to calling these services. ... exe$deanonpgdsiz desides that the size of the deallocation is such that it ... Does the memory layout have to follow a convention? ... As these routines raise IPL, I assume that you have to be in Kernel mode ...
    (comp.os.vms)