readahead(2) - Linux
Robert Watson
rwatson at FreeBSD.org
Tue Mar 4 15:12:48 UTC 2008
On Mon, 3 Mar 2008, Julian Elischer wrote:
> Ivan Voras wrote:
>> Ed Schouten wrote:
>>> * carlos neira <cneirabustos at gmail.com> wrote:
>>>> is there an equivalent of readahead syscall in linux , for freebsd ?. i
>>>> was looking at http://preload.sourceforge.net/ , and it needs this .
>>> Maybe a mmap(), followed by a madvise()?
>>
>> Or an open() followed by a read() loop? :) If the goal is to preload the
>> files, this one is certainly going to do it :)
>
> the aim is to load it into system memory but not copy anything into user
> memory.
In an ideal world (tm), a prefetch system call doesn't actually force the I/O
to happen, it just hints that if it did happen, life would then be better.
Then, in said ideal world (tm), the VM system can juggle investing pages in
memory and I/O capacity in heuristic read-ahead, prefetch hints from the
application, anonymously process memory, and buffer cache, based on what is
most effective for particular applications or workloads. Last time I read up
on I/O prefetching literature, it was considered quite difficult to place
prefetch calls in applications in a useful way, and that normal heuristic
read-ahead, which we already support, actually caught a high percentage of
real application cases since applications do tend to order and store data
usefully in files. For certain applications, though, that doesn't help much,
and there isn't a way to tune "up" read-ahead prefetching, so it could be
we're no longer doing as good a job.
Robert N M Watson
Computer Laboratory
University of Cambridge
More information about the freebsd-hackers
mailing list