Commit 9aafbb9e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] LRU race semi-fix

Couple of last-minute fixes please:

- Partial fix for the LRU race which Christian Ehrhardt identified.

- Delete a bogus BUG() in __page_cache_release
parent 6d603949
...@@ -77,7 +77,6 @@ void lru_add_drain(void) ...@@ -77,7 +77,6 @@ void lru_add_drain(void)
void __page_cache_release(struct page *page) void __page_cache_release(struct page *page)
{ {
unsigned long flags; unsigned long flags;
BUG_ON(page_count(page) != 0);
spin_lock_irqsave(&_pagemap_lru_lock, flags); spin_lock_irqsave(&_pagemap_lru_lock, flags);
if (TestClearPageLRU(page)) { if (TestClearPageLRU(page)) {
......
...@@ -389,8 +389,15 @@ static /* inline */ void refill_inactive(const int nr_pages_in) ...@@ -389,8 +389,15 @@ static /* inline */ void refill_inactive(const int nr_pages_in)
prefetchw_prev_lru_page(page, &active_list, flags); prefetchw_prev_lru_page(page, &active_list, flags);
if (!TestClearPageLRU(page)) if (!TestClearPageLRU(page))
BUG(); BUG();
list_del(&page->lru);
if (page_count(page) == 0) {
/* It is currently in pagevec_release() */
SetPageLRU(page);
list_add(&page->lru, &active_list);
continue;
}
page_cache_get(page); page_cache_get(page);
list_move(&page->lru, &l_hold); list_add(&page->lru, &l_hold);
nr_pages--; nr_pages--;
} }
spin_unlock_irq(&_pagemap_lru_lock); spin_unlock_irq(&_pagemap_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