Re: Memory fragmentation issue in kernel mode
- From: "Gianluca Varenni" <gianluca.varenni@xxxxxxxxxxxx>
- Date: Tue, 27 Feb 2007 08:48:32 -0800
"killme" <killme@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:553CE535-CD8D-4D53-8F5B-84BF514BF713@xxxxxxxxxxxxxxxx
Hi All,
I am having one peculiar problem in Windows XP SP2 (with all patches
applied). I have my driver that uses direct IO to perform data transfer
(the
data transfer will be in 256 KB buffers). I have one third party test
application which will be accessing my device to test the driver. When I
run
this application for around 1 million passes, then
MmGetSystemAddressForMdlSafe() fails in my driver. When I ran the ioctl
sample provided in DDK with different buffer sizes, it succeeded for 512
bytes and 4KB but failed for 64KB and afterwards indicating some memory
fragmentation. One more thing is that I never allocate any memory in the
driver during the process other than using MmGetSystemAddressxxx().
I have following questions:
1. In such scenario, what should a driver writer do? He can simply fail
the request and continue or try to access the MDL in a scatter/gather
manner
and continue based upon the importance of the device?
Well, if your driver can use this workaround, I would try that.
2. Will the system ever recover after such memory fragmentation?
3. Is it application's or system's responsibility to prevent memory
fragmentation? i.e. Is it an application bug or OS problem?
Well, a user level application can do very little with this kind of
fragmentation, which is actually fragmentation of the system virtual address
space. A user level application doesn't allocate and even access the system
virtual address space. A driver does (by allocating memory or mapping memory
from the process address space to system address space with
MmGetSystemAddress). But even in a driver, this is one the usual way to
dispatch IRPs. So strictly speaking, i think it's more of an OS problem.
....having said that, it seems quite weird that your machine's memory gets so
fragmented that the OS cannot map 64k of memory into system address space.
This operation is done literally thousands of times by the OS for every
communication between kernel mode and user mode. Are your direct io requests
synchronous or asynchronous? If asynch, how many concurrent IO requests (and
related mappings of MDLs to system address space) do you think you might
have?
Have a nice day
GV
.
- Follow-Ups:
- Re: Memory fragmentation issue in kernel mode
- From: Anton Bassov
- Re: Memory fragmentation issue in kernel mode
- Prev by Date: Re: ndis 6.0 required for Vista WHQL???
- Next by Date: BDA driver for USB Tuner device.
- Previous by thread: The most simple way to do syncronization...
- Next by thread: Re: Memory fragmentation issue in kernel mode
- Index(es):
Relevant Pages
|