[wdmaudiodev] Re: Doubt about MDL

  • From: Surabhi Ghaisas <ghaisas.surabhi@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 22 Nov 2012 12:04:55 +0530

Thanks Daniel.

Regards,
Surabhi

On Thu, Nov 22, 2012 at 11:51 AM, <daniel@xxxxxxxxxxxxxxxx> wrote:

> I  will be allocating a buffer and create corresponding MDL by using
>> function *AllocatePagesForMdl This method always allocates an integral
>> number of pages from nonpaged pool.
>>
>
> It does not. It allocates physical memory, not virtual memory or pool.
> Even if at some point you will get virtual addresses for them, that will
> not be charged against nonpaged pool.
>
> Does this mean that if i call *MmGetMdlByteOffset* with this MDL as i/p ,
>> the byteoffset returned by *MmGetMdlByteOffset* will always be zero?
>>
>
> Yes, it says it allocates an integral number of pages. That means a full
> first page.
>
> Is there any possibility of getting non zero offset indicating that event
>> though buffer is of say n pages the valid data starts at some non zero
>> offset of first page?
>>
>
> No, it says it allocates an integral number of pages only.
>
> Also when i allocate buffer using *AllocatePagesForMdl* is it guaranteed
>> that all rest of the pages are fully allocated for my buffer
>>
>
> No. It does not guarantee that it allocates all pages that you request. If
> there are not enough free physical pages, it returns an MDL with the memory
> it could allocate. Therefore you need to check the returned MDL with the
> MmGetMdlByteCount function to see how much memory you actually received.
>
> or do i need to traverse *PMDL**Next *element until mdl ends and find byte
>> offset within each page using *MmGetMdlByteOffset* ?
>>
>
> That doesn’t sound like a sensible thing to do.
>
> //Daniel
>
>
> ******************
>
> WDMAUDIODEV addresses:
> Post message: mailto:wdmaudiodev@freelists.**org<wdmaudiodev@xxxxxxxxxxxxx>
> Subscribe:    
> mailto:wdmaudiodev-request@**freelists.org<wdmaudiodev-request@xxxxxxxxxxxxx>
> ?subject=**subscribe
> Unsubscribe:  
> mailto:wdmaudiodev-request@**freelists.org<wdmaudiodev-request@xxxxxxxxxxxxx>
> ?subject=**unsubscribe
> Moderator:    
> mailto:wdmaudiodev-moderators@**freelists.org<wdmaudiodev-moderators@xxxxxxxxxxxxx>
>
> URL to WDMAUDIODEV page:
> http://www.wdmaudiodev.com/
>
>

Other related posts: