2.6.11-rc1: mark-page-accessed in filemap.c not quite right
Subsystems (2)
I just discovered there's a thinko in the mark-page-accessed change in do_generic_mapping_read() in 2.6.11-rc1. ra.prev_page is compared to index to see if we read from this page before - except that prev_page is actually set to the recent page or even a page in front of the current page.
So we should store ra.prev_page in a seperate variable at the start of do_generic_mapping_read().
This patch does just that:
mm/filemap.c renamed from mm/filemap.c.ORIG +4 -1
@@ -693,6 +693,7 @@unsigned long offset;unsigned long req_size;unsigned long next_index; +unsigned long prev_index;loff_t isize;struct page *cached_page;int error;
@@ -701,6 +702,7 @@ cached_page =NULL ; index = *ppos >>PAGE_CACHE_SHIFT ; next_index = index; + prev_index = ra.prev_page; req_size = (desc->count +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; offset = *ppos & ~PAGE_CACHE_MASK ;
@@ -754,8 +756,9 @@* When (part of) the same page is read multiple times * in succession, only mark it as accessed the first time. */ -if (ra.prev_page != index) +if (prev_index != index)mark_page_accessed (page); + prev_index = index;/* * Ok, we have the page, and it's up-to-date, so