Re: clearing filesystem cache for I/O benchmarks

From: Benjamin Rutt
Date: Mon Jul 26 2004 - 08:04:33 EST


Andrew Morton <akpm@xxxxxxxx> writes:

> Benjamin Rutt <rutt.4+news@xxxxxxx> wrote:
>>
>> How can I purge all of the kernel's filesystem caches, so I can trust
>> that my I/O (read) requests I'm trying to benchmark bypass the kernel
>> filesystem cache?
>
> Either delete the benchmark test files or

I'm not sure I follow. If I delete the benchmark files, I'll only
need to create them again later in order to do a read test, and I'll
have the same problem then, of how to eliminate the just-written-data
from cache. Unless you're suggesting I write using some special mode
that won't enter the written data into cache? (e.g. O_DIRECT?)

> , in 2.6, use fsync+posix_fadvise(POSIX_FADV_DONTNEED);

Thanks for the reference, I wasn't aware of that one. We are running
some 2.4 kernels in our storage cluster unfortunately so that won't be
usable for us everywhere. I take it POSIX_FADV_DONTNEED is ignored
under 2.4.

A related question...if no posix_fadvise() advice has been given, does
reading sequentially every byte of an 8GB file on a machine with <=
8GB of RAM guarantee that any page cache data that existed on the
machine prior to the start of the 8GB read is now gone?
--
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/