The patch titled readahead: return early when readahead is disabled has been added to the -mm tree. Its filename is readahead-return-early-when-readahead-is-disabled.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: readahead: return early when readahead is disabled From: Wu Fengguang <fengguang.wu@xxxxxxxxx> Reduce readahead overheads by returning early in do_sync_mmap_readahead(). tmpfs has ra_pages=0 and it can page fault really fast (not constraint by IO if not swapping). Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx> Tested-by: Tim Chen <tim.c.chen@xxxxxxxxx> Reported-by: Andi Kleen <ak@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/filemap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff -puN mm/filemap.c~readahead-return-early-when-readahead-is-disabled mm/filemap.c --- a/mm/filemap.c~readahead-return-early-when-readahead-is-disabled +++ a/mm/filemap.c @@ -1567,6 +1567,8 @@ static void do_sync_mmap_readahead(struc /* If we don't want any read-ahead, don't bother */ if (VM_RandomReadHint(vma)) return; + if (!ra->ra_pages) + return; if (VM_SequentialReadHint(vma) || offset - 1 == (ra->prev_pos >> PAGE_CACHE_SHIFT)) { @@ -1589,12 +1591,10 @@ static void do_sync_mmap_readahead(struc * mmap read-around */ ra_pages = max_sane_readahead(ra->ra_pages); - if (ra_pages) { - ra->start = max_t(long, 0, offset - ra_pages/2); - ra->size = ra_pages; - ra->async_size = 0; - ra_submit(ra, mapping, file); - } + ra->start = max_t(long, 0, offset - ra_pages / 2); + ra->size = ra_pages; + ra->async_size = 0; + ra_submit(ra, mapping, file); } /* _ Patches currently in -mm which might be from fengguang.wu@xxxxxxxxx are mm-per-node-vmstat-show-proper-vmstats.patch mm-per-node-vmstat-show-proper-vmstats-fix.patch writeback-pass-writeback_control-down-to-move_expired_inodes.patch writeback-introduce-writeback_controlinodes_cleaned.patch writeback-try-more-writeback-as-long-as-something-was-written.patch writeback-the-kupdate-expire-timestamp-should-be-a-moving-target.patch writeback-sync-expired-inodes-first-in-background-writeback.patch writeback-sync-expired-inodes-first-in-background-writeback-fix.patch writeback-refill-b_io-iff-empty.patch readahead-readahead-page-allocations-are-ok-to-fail.patch readahead-return-early-when-readahead-is-disabled.patch readahead-reduce-unnecessary-mmap_miss-increases.patch readahead-trigger-mmap-sequential-readahead-on-pg_readahead.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html