Commit 80b1573f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Honour the readahead tunable in filemap_nopage()

Remove the hardwired pagefault readaround distance in filemap_nopage() and
use the per-file readahead setting.

The main reason for this is in fact laptop-mode.  If you want to prevent the
disk from spinning up then you want all of your application's pages to be
pulled into memory in one hit.  Otherwise the disk will spin up each time you
use a new part of whatever application(s) you are running.
parent 26f14a57
......@@ -1006,7 +1006,6 @@ static int fastcall page_cache_read(struct file * file, unsigned long offset)
return error == -EEXIST ? 0 : error;
}
#define MMAP_READAROUND (16UL)
#define MMAP_LOTSAMISS (100)
/*
......@@ -1062,6 +1061,8 @@ struct page * filemap_nopage(struct vm_area_struct * area, unsigned long address
retry_find:
page = find_get_page(mapping, pgoff);
if (!page) {
unsigned long ra_pages;
if (VM_SequentialReadHint(area)) {
handle_ra_miss(mapping, ra, pgoff);
goto no_cached_page;
......@@ -1084,8 +1085,15 @@ struct page * filemap_nopage(struct vm_area_struct * area, unsigned long address
inc_page_state(pgmajfault);
}
did_readaround = 1;
do_page_cache_readahead(mapping, file,
pgoff & ~(MMAP_READAROUND-1), MMAP_READAROUND);
ra_pages = max_sane_readahead(file->f_ra.ra_pages);
if (ra_pages) {
long start;
start = pgoff - ra_pages / 2;
if (pgoff < 0)
pgoff = 0;
do_page_cache_readahead(mapping, file, pgoff, ra_pages);
}
goto retry_find;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment