Re: clearing buffer cache

Jan Kara (jack@atrey.karlin.mff.cuni.cz)
Wed, 6 Oct 1999 11:42:40 +0200


Hello.
> 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?
This should work... All buffers and inodes should be invalidated on unmount.

Honza.

-
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/