Re: clearing filesystem cache for I/O benchmarks

From: Benjamin Rutt
Date: Sun Jul 25 2004 - 19:09:27 EST


Tim Wright <timw@xxxxxxxxx> writes:

> Take a look at the code in hdparm tool that handles the '-f' option.
>
> Basically calling ioctl(fd, BLKFLSBUF, o) where fd is a file descriptor
> opened on the block device on which your filesystem resides should be
> enough to clear the cache.

Thanks, that looks pretty useful, at least to force the I/O to make it
outside the kernel. I'm still getting cache hits for some read tests
though, no doubt due to cache near the physical disks and/or
controllers. Correct me if I'm wrong, but this ioctl doesn't appear
to go out and tell disks to clear their caches.

I think I'll use the BLKFLSBUF in any case in my tests though, as it
doesn't seem to take very long to execute. It can't hurt, and should
complement the act of reading through a large dummy file, which should
take care of the disk/controller caches.
--
Benjamin Rutt

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