Re: 2.4.18(19) swapcache oops

From: Andrew Morton (akpm@zip.com.au)
Date: Thu Aug 15 2002 - 15:21:17 EST


Andrew Morton wrote:
>
> ...
> --- 2.4.19/mm/swap.c~lru-race Thu Aug 15 13:03:48 2002
> +++ 2.4.19-akpm/mm/swap.c Thu Aug 15 13:04:19 2002
> @@ -57,9 +57,10 @@ void activate_page(struct page * page)
> */
> void lru_cache_add(struct page * page)
> {
> - if (!TestSetPageLRU(page)) {
> + if (!PageLRU(page)) {
> spin_lock(&pagemap_lru_lock);
> - add_page_to_inactive_list(page);
> + if (!TestSetPageLRU(page))
> + add_page_to_inactive_list(page);
> spin_unlock(&pagemap_lru_lock);
> }
> }

Seems that I fixed this in 2.5.32. That set_bit outside
the lock gave me the willes, and I couldn't put my finger on why.
Never occurred to me that the page could be found via pagecache
lookup in this manner.

In 2.5, it is effectively:

void lru_cache_add(struct page * page)
{
        spin_lock(&pagemap_lru_lock);
        if (TestSetPageLRU(page))
                BUG();
        add_page_to_inactive_list(page);
        spin_unlock(&pagemap_lru_lock);
}

which is what should be tested in 2.4. It's stricter, and significantly
faster.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:40 EST