Yes, the CcMdl interfaces will lock the cache buffers into physical
memory. If the file object’s private cache map is NULL, it has not been
setup for caching. For all file objects passed to the cache manager
interfaces (either copy, mdl, or pin), caching must have been
initialized for the file object.
A filter can use the pinning interfaces, but you cannot mix their use
arbitrarily with the CcCopy interfaces. For example, a filter may want
to use the pinning interfaces to access its own private metadata file.
To lock pages, you first need a buffer which is backed by the pages you
are interested in locking. You create a MDL structure to represent the
buffer by calling IoAllocateMdl, then pass that MDL to
MmProbeAndLockPages. Both the DDK and IFS Kit documentation describe
these routines in more detail.
Thanks,
Molly Brown
Microsoft Corporation
This posting is provided “AS IS” with no warranties and confers no
rights.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of vikram
Sent: Saturday, February 21, 2004 7:25 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] Cache Replacement policy
Thanks Molly,
I have few issues doing this:
-
Can I use CcMdlRead and CcMdlReadComplete inorder to lock the pages
in the system cache while sitting in FSD filter driver. If possible give
some hints. We have tried using this but it is crashing because of
privateCacheMap is NULL.
-
Is it possible to pin the pages from FSD filter driver. using Pin
Interface of cache manager
-
How can i lock the pages using MmProbeAndLockPages while sitting over
the FSD.(Is it possible?)
Thanks in Advance.
=vikramsingh
“Molly Brown” wrote in message
news:xxxxx@ntfsd…
Data that is “pinned” into the system cache via the various pinning APIs
just ensures that the data stays mapped into the system cache’s virtual
address space. The memory manager could still choose to page this data
out of physical memory if it deems this necessary. The only way you can
ensure a page of data is not paged out is to lock it into memory
(MmProbeAndLockPages is the API commonly used).
BUT – I will strongly second Nick’s warning about doing this. By
locking the data into physical memory, you limit the flexibility of the
memory manager to respond to the memory demands of the system. If you
tie the memory manager’s hands too tightly, at best the system’s
performance will get much worse, at worst the system bugchecks.
I would suggest doing your best to design your product such that you use
techniques to prime the cache with the data your are interested in
(Nick’s suggestions will do just that for you), but you can cope with
your data not being resident in memory when the system is memory
constrained.
Thanks,
Molly Brown
Microsoft Corporation
This posting is provided “AS IS” with no warranties and confers no
rights.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Nick Ryan
Sent: Saturday, January 24, 2004 4:40 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] Cache Replacement policy
You can always force pages into the cache by generating your own cached
reads, and there are APIs to ‘pin’ ranges in the cache so they aren’t
purged (but I’ve never heard of a filesystem filter using these APIs in
this manner, so be careful).
vikram wrote:
> Thanks Nick,
> But i don;t want this. I have an alogrithm according to which i gotto
> know if x page is accessed at some moment then f(x) should be the
> next. and f(x) = f(y) even if x!=y. where x is increasing linearly. so
> i know that what are the pages which my process needs in future. And i
> don’t want OS to overwrite those pages by its default page replacement
algorithm.
> Can i make a page free before the OS uses its default page replacement
> by sitting on the filesystem.
>
> “Nick Ryan” wrote in message news:xxxxx@ntfsd…
>
>>The best of way of doing this is to use memory-mapping as appropriate
>>in your application to force ranges of the files that you use into
memory.
>>It’s not possible to dictate policy like this to the Cache Manager.
>>
>>vikram wrote:
>>
>>
>>>As my previous design fails to give the I/O priority to my process,
>>>so
>
> there
>
>>>is change in the design.
>>>I just want to know that whether its possible to change the cache
>>>page replacement policy while sitting over the file system filter
>>>driver. I
>
> don’t
>
>>>want the windows default LRU to replace the files that are accessed
>>>by
>
> my
>
>>>process upto a certain limit.
>>>In case of page fault mine filter driver to filesytem will allocate a
>
> page
>
>>>in the memory in case of empty free page list and zero page list.
>>>
>>>suggest some readings or give some hints Thanks in Advance.
>>>
>>>
>>>
>>
>>–
>>Nick Ryan
>>(Microsoft Windows MVP for DDK)
>>
>
>
>
>
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com