Re: [RFC] [PATCH] Include LRU in page count

Andrew Morton
2002-08-31T17:37:55Z

Christian Ehrhardt wrote:
>
> ...
> Solution: Change the PageLRU bit inside the lock. Looks like
> lru_cache_add is the only place that doesn't hold the lru lock to
> change the LRU flag and it's probably not a good idea even without
> the patch.
>

2.4.20-pre already does that:

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

there was an oopsing race with activate_page()...