clearing buffer cache

David Harris (dharris@drh.net)
Tue, 5 Oct 1999 10:47:52 -0400


Hi,

I want to do some testing with an application where I need to see how long it
takes to read various scattered user data files from disk. I want to be able to
run the program whenever I want with the buffer cache empty of those user data
files.

The only way I know to do this is just reboot the system before I run the
program each time, but that is really annoying. I went searching the
documentation and found the /proc/sys/vm/buffermem file which specifies the
min_percent, borrow_percent, and max_percent of memory to use for the buffer
cache. I thought I could temporarily set the max_percent really low and then
cause a bunch of disk IO on some other files. However, the kernel documentation
disagrees about that file: the Documentation/sysctl/vm.txt file says that the
borrow_percent and map_percent fields are unused, while the
Documentation/proc.txt file makes no note of them being unused.

Another idea just to mind... what if I mount and un-mount the filesystem
containing the user files. Would that effect a buffer cache clearing for all
inodes on that filesystem?

Does anyone have a good idea how I could do this? I'd love something easy like
a /proc file that when written to expires all the clean and dirty blocks in the
buffer cache. But I'll be happy with anything easier than a system reboot.

Thanks in advance for any help.

- David Harris
Principal Engineer, DRH Internet Services

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/