> So, is that means when windows OS write data to disk, it used
IRP->mdladdress to carry on data, not by page. I mean for driver
developers, we can just touch IRP->Mdladdr or userbuffer, but we cant
touch page to transfer application layer data to disk.
So 4k page size is invisible for drv developers, all we can touch is
the IRP by IRP->write.parameter.longth, but dont know how it work in
page replacement.
Am I right? Thanks D
The critical question is, why should you care how page replacement works?
You can’t touch the page using IRP->write.parameter.length because that
isn’t an address, it is a length, and does not allow you to touch
anything. In fact, in a write operation, you are not permitted to “touch”
the location by writing; you may only read it, because its writeability is
absolutely NOT guaranteed. And if your device does DMA, you do not need
to know the addresses in user space, and you don’t need to have addresses
in kernel space. You create a scatter/gather list that gives you the
physical addresses to program your DMA device with. And, if you are not
doing DMA, reads don’t change the page state, so it doesn’t matter; the
page is locked into memory if you are using Direct I/O, or it is in the
kernel buffer if you are using buffered I/O. MmGetSystemAddressForMdlSafe
would be used if you are using Direct I/O, and all write.parameter.length
gives you is the range of addresses you may read. So if MmGSAFMS gives
you A, and write.parameter.length is N (bytes), then the valid addresses
you can read are A through A+N-1.
Page replacement strategy plays no part in any of this.
If you are using Mode Neither, which is a very tricky mode for a beginner
to play with, you will probably lock the pages down yourself, in small
groups. In which case, page replacement doesn’t matter to you. So you
need to explain why you have any need at all to know how it works.
Note that the range of time when UserBuffer makes any sense is very
limited; it is only valid when used in the context of the calling thread,
a very brief moment in the existence of the IRP. For all practical
purposes, UserBuffer plays no role in anything you will need in Direct or
Buffered I/O. In Direct I/O, UserBuffer is not defined for write
operations, so it is completely meaningless to you. So unless you are
using Mode Neither, you MUST avoid UserBuffer. If you are using Mode
Neither, you have already bought yourself sufficient pain and suffering,
and you don’t need to add any more by worrying about page replacement.
So you have not explained in any way why you feel you should know or care
about how pages are replaced.
And seeing Don’s reply below, it wouldn’t matter if you WERE doing this in
Linux, you would probably STILL not have a valid reason for modifying the
paging algorithm.
joe
Quoting Don Burn :
>
>> There is nothing you can get at in the Windows paging system. I had
>> these
>> discussions with Microsoft for a number of years as part of an effort
>> for a
>> startup that never got going. Bottom line, accept Windows paging as it
>> is,
>> there are essentially no hooks to modify it. Windows is not Linux.
>>
>>
>> Don Burn
>> Windows Filesystem and Driver Consulting
>> Website: http://www.windrvr.com
>> Blog: http://msmvps.com/blogs/WinDrvr
>>
>>
>>
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>> xxxxx@ele.uri.edu
>> Sent: Wednesday, September 04, 2013 12:57 PM
>> To: Windows System Software Devs Interest List
>> Subject: RE: [ntdev] In which driver layer could operate page in windows
>>
>> Thanks Doron Holan:
>>
>> I am asking this because of I read some paper about page replacement.
>> Such algrithm has been implement on linux used virtual memory tech (I
>> dont
>> know that). It used both simulation and implementation on linux kernel.
>>
>> I am thinking does windows can do such page replacement algrithm on it,
>> other wise is there has some one to do simulation work on windows
>> platform
>> to test page replacement algrithm?
>>
>> Any ideas will be helpful. Thank you D.
>>
>>
>>
>> Quoting Doron Holan :
>>
>>> The paging algorithm is private to the memory manager in the kernel,
>>> you can’t change it with your own. What problem are you trying to
>>> solve?
>>>
>>> d
>>>
>>> Bent from my phone
>>> ________________________________
>>> From: xxxxx@ele.uri.edumailto:xxxxx
>>> Sent: ?9/?3/?2013 7:54 PM
>>> To: Windows System Software Devs Interest
>>> Listmailto:xxxxx
>>> Subject: [ntdev] In which driver layer could operate page in windows
>>>
>>> Hi all, I want ask a question about page operation in windows.
>>>
>>> How does windows doing page replacement? Is there some way to modify
>>> the original page replacement algrithm in OS?
>>>
>>> could windows file system minifilter do this job instead of replace
>>> the whole file system?
>>>
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>>
>>> OSR is HIRING!! See http://www.osr.com/careers
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>>
>>> OSR is HIRING!! See http://www.osr.com/careers
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></mailto:xxxxx></mailto:xxxxx>