Information Technology Reference
In-Depth Information
Figure 6. The readahead framework in Linux 2.6.24
from the read size, and then ramps up exponen-
tially to max_readahead. However in the case of
a large sendfile() call, the readahead window can
immediately expand to its full size. The resulting
readahead size is adaptive to the current read size as
well as the accumulated sequential read sizes.
We conclude this section with the block dia-
gram of the demand readahead in Linux 2.6.24.
whose initial async_size is such that the second
sequential read request will immediately trigger
the next readahead asynchronously. The goal of
the rules is to start asynchronous readahead as
soon as possible, while trying to avoid useless
readahead for applications that only examine the
file head.
readahead cache hits
caSe Study
Linux manages kernel level “page cache” to keep
frequently accessed file pages in memory. A read
request for an already cached page is called a
“cache hit”, otherwise it is a “cache miss”. If a
readahead request is made for an already cached
page, it makes a “readahead cache hit”. Cache
hits are good whereas readahead cache hits are
evil: they are undesirable and normally avoidable
overheads. Since cache hits can far outweigh
a typical readahead Stream
Take the “cp” command as an example, it does
4KB page sized sequential reads covering the
whole file. Table 2 and figure 7 demonstrates the
first three readahead invocations. The initial read
triggers a readahead that is four times the read size,
Search WWH ::




Custom Search