Index: linux-2.6/mm/vmscan.c =================================================================== --- linux-2.6.orig/mm/vmscan.c +++ linux-2.6/mm/vmscan.c @@ -390,7 +390,7 @@ static pageout_t pageout(struct page *pa } /* - * Save as remove_mapping, but if the page is removed from the mapping, it + * Same as remove_mapping, but if the page is removed from the mapping, it * gets returned with a refcount of 0. */ static int __remove_mapping(struct address_space *mapping, struct page *page) @@ -618,6 +618,13 @@ static unsigned long shrink_page_list(st if (put_page_testzero(page)) goto free_it; else { + /* + * rare race with speculative reference. + * the speculative reference will free + * this page shortly, so we may + * increment nr_reclaimed here (and + * leave it off the LRU). + */ nr_reclaimed++; continue; } @@ -627,8 +634,8 @@ static unsigned long shrink_page_list(st if (!mapping || !__remove_mapping(mapping, page)) goto keep_locked; -free_it: unlock_page(page); +free_it: nr_reclaimed++; if (!pagevec_add(&freed_pvec, page)) { __pagevec_free(&freed_pvec);