Add Wired list to LRU.
Add PG_Wired bit to page.
diff -urN linux-2.6.15.orig/mm/swap.c linux-2.6.15/mm/swap.c
--- linux-2.6.15.orig/mm/swap.c 2006-01-02 22:21:10.000000000 -0500
+++ linux-2.6.15/mm/swap.c 2006-03-07 11:45:37.000000000 -0500
@@ -110,6 +110,44 @@
spin_unlock_irq(&zone->lru_lock);
}
+/* Wire the page; if the page is in LRU,
+ * try move it to Wired list.
+ */
+void fastcall wire_page(struct page *page)
+{
+ struct zone *zone = page_zone(page);
+
+ spin_lock_irq(&zone->lru_lock);
+ page->wired_count ++;
+ if(!PageWired(page)){
+ if(PageLRU(page)){
+ del_page_from_lru(zone, page);
+ add_page_to_wired_list(zone,page);
+ SetPageWired(page);
+ }
+ }
+ spin_unlock_irq(&zone->lru_lock);
+}
+
+/* Unwire the page.
+ * If it isnt wired by any process, try move it to active list.
+ */
+void fastcall unwire_page(struct page *page)
+{
+ struct zone *zone = page_zone(page);
+
+ spin_lock_irq(&zone->lru_lock);
+ page->wired_count --;
+ if(!page->wired_count){
+ if(PageLRU(page) && TestClearPageWired(page)){
+ del_page_from_wired_list(zone,page);
+ add_page_to_active_list(zone,page);
+ SetPageActive(page);
+ }
+ }
+ spin_unlock_irq(&zone->lru_lock);
+}
+
/*
* Mark a page as having seen activity.
*
@@ -119,11 +157,13 @@
*/
void fastcall mark_page_accessed(struct page *page)
{
- if (!PageActive(page) && PageReferenced(page) && PageLRU(page)) {
- activate_page(page);
- ClearPageReferenced(page);
- } else if (!PageReferenced(page)) {
- SetPageReferenced(page);
+ if(!PageWired(page)) {
+ if (!PageActive(page) && PageReferenced(page) && PageLRU(page)) {
+ activate_page(page);
+ ClearPageReferenced(page);
+ } else if (!PageReferenced(page)) {
+ SetPageReferenced(page);
+ }
}
}
@@ -178,13 +218,15 @@
struct zone *zone = page_zone(page);
spin_lock_irqsave(&zone->lru_lock, flags);
- if (TestClearPageLRU(page))
- del_page_from_lru(zone, page);
- if (page_count(page) != 0)
- page = NULL;
+ if(!PageWired(page)) {
+ if (TestClearPageLRU(page))
+ del_page_from_lru(zone, page);
+ if (page_count(page) != 0)
+ page = NULL;
+ if (page)
+ free_hot_page(page);
+ }
spin_unlock_irqrestore(&zone->lru_lock, flags);
- if (page)
- free_hot_page(page);
}
EXPORT_SYMBOL(__page_cache_release);
@@ -214,7 +256,8 @@
if (!put_page_testzero(page))
continue;
-
+ if(PageWired(page))
+ continue;
pagezone = page_zone(page);
if (pagezone != zone) {
if (zone)