[PATCH 16/16] io: reduce lantency

From: Wu Fengguang
Date: Wed Nov 09 2005 - 09:16:25 EST


This is recommended by Con Kolivas to improve respond time for desktop.

Since the VM_MAX_READAHEAD is greatly enlarged, it may be necessary to insert
some cond_resched() calls. Correct me, I'm not quite sure about the effects.

Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx>
---


fs/mpage.c | 4 +++-
mm/readahead.c | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)

--- linux-2.6.14-mm1.orig/mm/readahead.c
+++ linux-2.6.14-mm1/mm/readahead.c
@@ -582,8 +582,10 @@ static int read_pages(struct address_spa
if (!add_to_page_cache(page, mapping,
page->index, GFP_KERNEL)) {
mapping->a_ops->readpage(filp, page);
- if (!pagevec_add(&lru_pvec, page))
+ if (!pagevec_add(&lru_pvec, page)) {
__pagevec_lru_add(&lru_pvec);
+ cond_resched();
+ }
} else {
page_cache_release(page);
}
@@ -701,6 +703,7 @@ __do_page_cache_readahead(struct address
}

read_unlock_irq(&mapping->tree_lock);
+ cond_resched();
page = page_cache_alloc_cold(mapping);
read_lock_irq(&mapping->tree_lock);
if (!page)
--- linux-2.6.14-mm1.orig/fs/mpage.c
+++ linux-2.6.14-mm1/fs/mpage.c
@@ -343,8 +343,10 @@ mpage_readpages(struct address_space *ma
bio = do_mpage_readpage(bio, page,
nr_pages - page_idx,
&last_block_in_bio, get_block);
- if (!pagevec_add(&lru_pvec, page))
+ if (!pagevec_add(&lru_pvec, page)) {
__pagevec_lru_add(&lru_pvec);
+ cond_resched();
+ }
} else {
page_cache_release(page);
}

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/