Commit a5bef68d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] start anon pages on the active list

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.
parent 8f7a1404
...@@ -194,8 +194,10 @@ void pagevec_deactivate_inactive(struct pagevec *pvec) ...@@ -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. * on them. Reinitialises the caller's pagevec.
*
* Mapped pages go onto the active list.
*/ */
void __pagevec_lru_add(struct pagevec *pvec) void __pagevec_lru_add(struct pagevec *pvec)
{ {
...@@ -214,7 +216,13 @@ void __pagevec_lru_add(struct pagevec *pvec) ...@@ -214,7 +216,13 @@ void __pagevec_lru_add(struct pagevec *pvec)
} }
if (TestSetPageLRU(page)) if (TestSetPageLRU(page))
BUG(); 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) if (zone)
spin_unlock_irq(&zone->lru_lock); spin_unlock_irq(&zone->lru_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment