[PATCH] readahead optimisations
Been looking at a workload which involves several processes which seek around and read from a large file. There are a few problems: generic_file_lseek is bouncing i_sem around like mad, and readahead is doing lots of pointless pagecache probing. This patch addresses readahead. Presumably the change will be larger on machines which have higher bandwidth memory than my test box, of which there are many. This patch teaches readahead to detect the situation where no IO is actually being performed as a result of its actions. Now, we don't want to sacrifice IO efficiency to save a bit of CPU, so the code is very cautious. But eventually, after some tens of consecutive readahead attempts were found to perform no I/O at all, readahead will turn itself off. readahead will be turned on again when either generic_file_read() or filemap_nopage() get a pagecache miss. The function handle_ra_thrashing() has been renamed to handle_ra_miss() to reflect its widened role. A performance bug in page_cache_readround() was fixed - if ra->next_size is zero, that function needs to leave it well alone, because next_size==0 is a magic value meaning that the file has just been opened and that readahead needs to get aggressive. This change makes a `make dep' run at the same speed as in the 2.4 kernel. It used to take 4x as long... `make dep' is an interesting test because it uses mmap to read the files.
Showing
Please register or sign in to comment