[PATCH -mm 08/24] vmscan: fix pagecache reclaim referenced bit check

From: Rik van Riel
Date: Wed Jun 11 2008 - 14:50:33 EST


From: Rik van Riel <riel@xxxxxxxxxx>

The -mm tree contains the patch
vmscan-give-referenced-active-and-unmapped-pages-a-second-trip-around-the-lru.patch
which gives referenced pagecache pages another trip around
the active list. This seems to help keep frequently accessed
pagecache pages in memory.

However, it means that pagecache pages that get moved to the
inactive list do not have their referenced bit set, and the
next access to the page will not get it moved back to the active
list. This patch sets the referenced bit on pagecache pages
that get deactivated, so the next access to the page will promote
it back to the active list.

This works because shrink_page_list() will reclaim unmapped
pages with the referenced bit set.

Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>

---
mm/vmscan.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Index: linux-2.6.26-rc5-mm2/mm/vmscan.c
===================================================================
--- linux-2.6.26-rc5-mm2.orig/mm/vmscan.c 2008-06-10 13:35:58.000000000 -0400
+++ linux-2.6.26-rc5-mm2/mm/vmscan.c 2008-06-10 13:40:19.000000000 -0400
@@ -1070,8 +1070,16 @@ static void shrink_active_list(unsigned
/* Anonymous pages always get deactivated. */
list_add(&page->lru, &l_inactive);
}
- } else
+ } else {
list_add(&page->lru, &l_inactive);
+ if (!page_mapping_inuse(page))
+ /*
+ * Bypass use-once, make the next access
+ * count. See mark_page_accessed and
+ * shrink_page_list.
+ */
+ SetPageReferenced(page);
+ }
}

/*

--
All Rights Reversed

--
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/