Commit 12f189a1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] reduced locking in release_pages()

From Marcus Alanen <maalanen@ra.abo.fi>

Don't retake the zone lock after spilling a batch of pages into the
buddy.

Instead, just clear local variable `zone' to indicate that no lock is
held.

This is actually a common case - whenever release_pages() is called
with exactly 16 pages (truncate, page reclaim..) Marcus' patch will
save a lock and an unlock.

Also, remove some lock-avoidance heuristics in
pagevec_deactivate_inactive(): the caller has already made these
checks, and the chance of the check here actually doing anything useful
is negligible.
parent e19941e9
......@@ -124,9 +124,9 @@ void release_pages(struct page **pages, int nr)
if (page_count(page) == 0) {
if (!pagevec_add(&pages_to_free, page)) {
spin_unlock_irq(&zone->lru_lock);
pagevec_free(&pages_to_free);
__pagevec_free(&pages_to_free);
pagevec_init(&pages_to_free);
spin_lock_irq(&zone->lru_lock);
zone = NULL; /* No lock is held */
}
}
}
......@@ -165,8 +165,8 @@ void __pagevec_release_nonlru(struct pagevec *pvec)
}
/*
* Move all the inactive pages to the head of the inactive list
* and release them. Reinitialises the caller's pagevec.
* Move all the inactive pages to the head of the inactive list and release
* them. Reinitialises the caller's pagevec.
*/
void pagevec_deactivate_inactive(struct pagevec *pvec)
{
......@@ -180,8 +180,6 @@ void pagevec_deactivate_inactive(struct pagevec *pvec)
struct zone *pagezone = page_zone(page);
if (pagezone != zone) {
if (PageActive(page) || !PageLRU(page))
continue;
if (zone)
spin_unlock_irq(&zone->lru_lock);
zone = pagezone;
......
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