lkml.org 
[lkml]   [2011]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 04/10] readahead: tag mmap page fault call sites
Introduce a bit field ra->for_mmap for tagging mmap reads.
The tag will be cleared immediate after submitting the IO.

Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
include/linux/fs.h | 1 +
mm/filemap.c | 6 +++++-
mm/readahead.c | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)

--- linux-next.orig/include/linux/fs.h 2011-12-16 19:36:12.000000000 +0800
+++ linux-next/include/linux/fs.h 2011-12-16 19:36:12.000000000 +0800
@@ -949,6 +949,7 @@ struct file_ra_state {
unsigned int ra_pages; /* Maximum readahead window */
u16 mmap_miss; /* Cache miss stat for mmap accesses */
u8 pattern; /* one of RA_PATTERN_* */
+ unsigned int for_mmap:1; /* readahead for mmap accesses */

loff_t prev_pos; /* Cache last read() position */
};
--- linux-next.orig/mm/filemap.c 2011-12-16 19:36:12.000000000 +0800
+++ linux-next/mm/filemap.c 2011-12-16 19:36:12.000000000 +0800
@@ -1578,6 +1578,7 @@ static void do_sync_mmap_readahead(struc
return;

if (VM_SequentialReadHint(vma)) {
+ ra->for_mmap = 1;
page_cache_sync_readahead(mapping, ra, file, offset,
ra->ra_pages);
return;
@@ -1597,6 +1598,7 @@ static void do_sync_mmap_readahead(struc
/*
* mmap read-around
*/
+ ra->for_mmap = 1;
ra->pattern = RA_PATTERN_MMAP_AROUND;
ra_pages = max_sane_readahead(ra->ra_pages);
ra->start = max_t(long, 0, offset - ra_pages / 2);
@@ -1622,9 +1624,11 @@ static void do_async_mmap_readahead(stru
return;
if (ra->mmap_miss > 0)
ra->mmap_miss--;
- if (PageReadahead(page))
+ if (PageReadahead(page)) {
+ ra->for_mmap = 1;
page_cache_async_readahead(mapping, ra, file,
page, offset, ra->ra_pages);
+ }
}

/**
--- linux-next.orig/mm/readahead.c 2011-12-16 19:36:12.000000000 +0800
+++ linux-next/mm/readahead.c 2011-12-16 19:36:12.000000000 +0800
@@ -259,6 +259,7 @@ unsigned long ra_submit(struct file_ra_s
actual = __do_page_cache_readahead(mapping, filp,
ra->start, ra->size, ra->async_size);

+ ra->for_mmap = 0;
return actual;
}




\
 
 \ /
  Last update: 2011-12-19 11:41    [W:0.071 / U:0.828 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site