Ashif Harji wrote:
> 
> This patch unconditionally calls mark_page_accessed to prevent pages,
> especially for small files, from being evicted from the page cache
> despite frequent access.
> 
> Signed-off-by: Ashif Harji <[EMAIL PROTECTED]>
> 

I like mine better -- it leaves the comment:


From: Chuck Ebbert <[EMAIL PROTECTED]>

Always mark page as accessed when reading multiple times.
Original idea and patch by Ashif Harji <[EMAIL PROTECTED]>

Signed-off-by: Chuck Ebbert <[EMAIL PROTECTED]>

--- 2.6.20.2-t.orig/mm/filemap.c
+++ 2.6.20.2-t/mm/filemap.c
@@ -887,7 +887,6 @@
        unsigned long offset;
        unsigned long last_index;
        unsigned long next_index;
-       unsigned long prev_index;
        loff_t isize;
        struct page *cached_page;
        int error;
@@ -896,7 +895,6 @@
        cached_page = NULL;
        index = *ppos >> PAGE_CACHE_SHIFT;
        next_index = index;
-       prev_index = ra.prev_page;
        last_index = (*ppos + desc->count + PAGE_CACHE_SIZE-1) >> 
PAGE_CACHE_SHIFT;
        offset = *ppos & ~PAGE_CACHE_MASK;
 
@@ -945,11 +943,9 @@
 
                /*
                 * When (part of) the same page is read multiple times
-                * in succession, only mark it as accessed the first time.
+                * in succession, always mark it accessed.
                 */
-               if (prev_index != index)
-                       mark_page_accessed(page);
-               prev_index = index;
+               mark_page_accessed(page);
 
                /*
                 * Ok, we have the page, and it's up-to-date, so

Reply via email to