Yes, this patch also solves the problem.
I just noticed that when reading from an umounted block device, the pages
are not cached between runs, i.e. the cache is dropped on close(). If the
block device contains a mounted filesystem, the pages are not dropped.
Is this intentional?
I was also thinking about Simon's CD-burning case, and the fact that the
used-once logic really does not work very well for such cases. You
usually first run mkisofs to create the image, and then read the image
when writing the CD. This is similar to running
dd if=/dev/zero of=/tmp/cd bs=1M count=300
dd if=/tmp/cd of=/dev/null
In this case, the pages are activated. That is not too bad, since the
system now seems to be able to free even active cache pages before paging
out stuff. (BTW, does it always free all cache before paging out?
That would most likely be very bad for many scenarios.)
So, for the CD-burning case, a used-twice algorithm would probably perform
better. Or perhaps the pages should be activated after having been _read_
more than once, not counting the writes. I wish I had the time to try
this out... :-(
This should only matter if the file is smaller than the amount of
available RAM, which is not too common for CD images.
/Tobias
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/