On Mon, 3 Oct 2011, David Howells wrote: > > Mark Hills <mark@xxxxxxxxxxx> 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. [...] > 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 think you have hit the nail on the head. I suspected the same and shortly after the last email I did some more tests. The files total 5.1GB, and there is 8GB of RAM in the machine. In the cachefiled case, the RAM is exhausted; effectively there is only 4GB available for caching. A test like this (I was doing sequential image playback) cannot make use the cache at all. > I wonder if there's a way to tell the VM to discard the backing pages I've > finished with... You can reasonably do it from userland using madvise(2), so hopefully it's not too difficult in the kernel. > 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. I tried this and it also confirmed the same -- approx. 50% of the memory attributed to each mount point. Many thanks -- Mark $ /sbin/cachefilesd $ echo 3 > /proc/sys/vm/drop_caches $ cat /proc/meminfo | grep ^Cached Cached: 26128 kB $ time cat * > /dev/null # first read, with cachefilesd 0:21.50 $ cat /proc/meminfo | grep ^Cached Cached: 7748968 kB $ time cat * > /dev/null # second read, with cachefilesd -- same 0:22.56 $ echo 3 > /proc/sys/vm/drop_caches $ cat /proc/meminfo | grep ^Cached Cached: 26128 kB $ killall cachefilesd $ time cat * > /dev/null # first read on plain NFS 1:44.19 $ cat /proc/meminfo | grep ^Cached Cached: 5431492 kB $ time cat * > /dev/null # second read on plain NFS -- from RAM 0:03.54 -- Linux-cachefs mailing list Linux-cachefs@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/linux-cachefs