lkml.org 
[lkml]   [2009]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 05/14] readahead: account mmap_miss for VM_FAULT_RETRY
The VM_FAULT_RETRY case introduced a performance bug that leads to
excessive/unconditional mmap readarounds for wild random mmap reads.

A retried page fault means a mmap readahead miss(mmap_miss++) followed by
a hit(mmap_miss--) on the same page. This sticks mmap_miss, and thus stops
mmap readaround from being turned off for wild random reads. Fix it by an
extra mmap_miss increament in order to counteract the followed mmap hit.

Also make mmap_miss a more robust 'unsigned int', so that if ever mmap_miss
goes out of range, it only create _temporary_ performance impacts.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
include/linux/fs.h | 2 +-
mm/filemap.c | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)

--- mm.orig/mm/filemap.c
+++ mm/mm/filemap.c
@@ -1574,8 +1574,10 @@ retry_find:
vmf->pgoff, 1);
retry_ret = find_lock_page_retry(mapping, vmf->pgoff,
vma, &page, retry_flag);
- if (retry_ret == VM_FAULT_RETRY)
+ if (retry_ret == VM_FAULT_RETRY) {
+ ra->mmap_miss++; /* counteract the followed retry hit */
return retry_ret;
+ }
if (!page)
goto no_cached_page;
}
@@ -1617,8 +1619,10 @@ retry_find:
retry_find_retry:
retry_ret = find_lock_page_retry(mapping, vmf->pgoff,
vma, &page, retry_flag);
- if (retry_ret == VM_FAULT_RETRY)
+ if (retry_ret == VM_FAULT_RETRY) {
+ ra->mmap_miss++; /* counteract the followed retry hit */
return retry_ret;
+ }
if (!page)
goto no_cached_page;
}
--- mm.orig/include/linux/fs.h
+++ mm/include/linux/fs.h
@@ -824,7 +824,7 @@ struct file_ra_state {
there are only # of pages ahead */

unsigned int ra_pages; /* Maximum readahead window */
- int mmap_miss; /* Cache miss stat for mmap accesses */
+ unsigned int mmap_miss; /* Cache miss stat for mmap accesses */
loff_t prev_pos; /* Cache last read() position */
};

--



\
 
 \ /
  Last update: 2009-04-07 14:05    [W:0.182 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site