]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] LRU race semi-fix
authorAndrew Morton <akpm@zip.com.au>
Tue, 27 Aug 2002 05:11:32 +0000 (22:11 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 27 Aug 2002 05:11:32 +0000 (22:11 -0700)
Couple of last-minute fixes please:

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

- Delete a bogus BUG() in __page_cache_release

mm/swap.c
mm/vmscan.c

index b2e8574ac37915ff775fa9e11b2db2652fa451cf..11db1a9a637669f5db2f2d982f47b2f9c81b467e 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -77,7 +77,6 @@ void lru_add_drain(void)
 void __page_cache_release(struct page *page)
 {
        unsigned long flags;
-       BUG_ON(page_count(page) != 0);
 
        spin_lock_irqsave(&_pagemap_lru_lock, flags);
        if (TestClearPageLRU(page)) {
index d2dc38fd7bec7b4c37bdfbf7c10e5abea4c2b093..6c673e2fb955515bae6929dedbdd39a56449e2da 100644 (file)
@@ -389,8 +389,15 @@ static /* inline */ void refill_inactive(const int nr_pages_in)
                prefetchw_prev_lru_page(page, &active_list, flags);
                if (!TestClearPageLRU(page))
                        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);
-               list_move(&page->lru, &l_hold);
+               list_add(&page->lru, &l_hold);
                nr_pages--;
        }
        spin_unlock_irq(&_pagemap_lru_lock);