]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] start anon pages on the active list
authorAndrew Morton <akpm@digeo.com>
Sun, 13 Oct 2002 02:33:11 +0000 (19:33 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 13 Oct 2002 02:33:11 +0000 (19:33 -0700)
We're currently adding anon pages to the inactive list.  But they're
all referenced, so when they reach the tail of the inactive list the
kernel will always then bump them up to the active list.

Not only does this waste CPU, but it leads to inactive/active
imbalance.  We end up with enormous sequences of unreclaimable,
to-be-activated pages hitting the tail of the LRU and large amounts of
scanning need to be done.  Which upsets the VM, making it think that it
is "under distress".

So just start them out on the active list.

mm/swap.c

index f0cd9260bb29e86f7c2b3a15dfc1dddbaf186a61..72f4c9cdd5c4f8a89be980f99c082f619035cc0f 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -194,8 +194,10 @@ void pagevec_deactivate_inactive(struct pagevec *pvec)
 }
 
 /*
- * Add the passed pages to the inactive_list, then drop the caller's refcount
+ * Add the passed pages to the LRU, then drop the caller's refcount
  * on them.  Reinitialises the caller's pagevec.
+ *
+ * Mapped pages go onto the active list.
  */
 void __pagevec_lru_add(struct pagevec *pvec)
 {
@@ -214,7 +216,13 @@ void __pagevec_lru_add(struct pagevec *pvec)
                }
                if (TestSetPageLRU(page))
                        BUG();
-               add_page_to_inactive_list(zone, page);
+               if (page_mapped(page)) {
+                       if (TestSetPageActive(page))
+                               BUG();
+                       add_page_to_active_list(zone, page);
+               } else {
+                       add_page_to_inactive_list(zone, page);
+               }
        }
        if (zone)
                spin_unlock_irq(&zone->lru_lock);