[Linux-cachefs] Page cache ignored on second read

David Howells dhowells at redhat.com
Mon Oct 3 15:43:31 UTC 2011


Mark Hills <mark at pogo.org.uk> wrote:

> But now that I can reasonably use fscache with NFS, I noticed that the 
> page cache doesn't seem to be used?
> 
> * When cachefilesd is running, reads do not come from the page cache

Hmmm.

> * The page cache fills up with something, but the local cache filesystem
>   continues to be read

The cache files themselves also get read into the pagecache.  Ideally I'd have
them do direct I/O, but that's not easy with Linux.

> In the first cases, I'm not sure if the page cache memory contains NFS 
> pages, or local disk pages. Is there an easy way to check?

You can watch /proc/fs/fscache/stats to see what fscache is being asked to do,
though I'm not sure how much that helps you.

These two lines:

	Retrvls: n=48497 ok=20622 wt=11867 nod=27871 nbf=0 int=0 oom=0
	Retrvls: ops=48497 owt=12134 abt=0

indicate the number of retrieval operations taking place (n), the number that
were satisfied from disk (ok) and the number for which the disk contained no
data (nod).

Also these two lines:

	Stores : n=70254 ok=70254 agn=0 nbf=0 oom=0
	Stores : ops=27311 run=97136 pgs=69825 rxd=70208 olm=0

which indicate the number of page storage requests given to fscache (n) and
completed (ok).  The number of internal storage operations (ops) is also shown
(an op may write more than one page, so n!=ops is okay).

A retrieval should only occur when the netfs doesn't have the data to hand,
but will take two pages to complete with CacheFiles.  The backing page is
immediately discardable once the data it contains has been copied to the netfs
page - but it does mean that your pagecache may be only half as efficient as
it could be for those files.

I wonder if there's a way to tell the VM to discard the backing pages I've
finished with...

Attached is the program I use for watching files like this (I prefer it to
watch + cat).  Just compile and give it the name of the file you want to
watch.

Another way to find out, though it's a bit drastic, is to unmount the net or
backing fs and see how much space becomes available.

David

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: filewatch.c
URL: <http://listman.redhat.com/archives/linux-cachefs/attachments/20111003/cfada74c/attachment.c>


More information about the Linux-cachefs mailing list