[PATCH] filemap.c fixes

Rik van Riel (riel@conectiva.com.br)
Mon, 14 May 2001 01:00:39 -0300 (BRST)


Hi Linus,

here are a filemap.c fix and a slight addition:

1) __find_page_nolock should only set the referenced bit
on an active page, otherwise a number of subsequent
reads from the same page within one page scan interval
can SEVERELY mess up page aging to the disadvantage of
the other pages in the system ...
just setting the referenced bit on the page makes the
aging a lot fairer

2) in drop_behind() we first increase the page age and
will then proceed to deactivate the page again; better
have a simpler help function for this ... note that this
help function could also be used for eg. ->writepage()
write clustering code

regards,

Rik

--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

http://www.surriel.com/ http://distro.conectiva.com/

Send all your spam to aardvark@nl.linux.org (spam digging piggy)

--- linux-2.4.5-pre1/mm/filemap.c.orig Mon May 14 00:55:53 2001 +++ linux-2.4.5-pre1/mm/filemap.c Mon May 14 00:56:03 2001 @@ -299,13 +299,14 @@ break; } /* - * Touching the page may move it to the active list. - * If we end up with too few inactive pages, we wake - * up kswapd. + * Mark the page referenced, moving inactive pages to the + * active list. */ - age_page_up(page); - if (inactive_shortage() > inactive_target / 2 && free_shortage()) - wakeup_kswapd(); + if (!PageActive(page)) + activate_page(page); + else + SetPageReferenced(page); + not_found: return page; } @@ -783,8 +784,7 @@ */ spin_lock(&pagecache_lock); while (--index >= start) { - hash = page_hash(mapping, index); - page = __find_page_nolock(mapping, index, *hash); + page = __find_page_simple(mapping, index); if (!page) break; deactivate_page(page);

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