Re: find_get_swapcache_page() question

Hugh Dickins (hugh@veritas.com)
Tue, 28 Aug 2001 12:27:55 +0100 (BST)


On Mon, 27 Aug 2001, Marcelo Tosatti wrote:
>
> Looking at find_get_swapcache_page(), I can't see _how_ we can find a
> page on the swapper pagecache table that is not a swapcache page.

I had a look at this a couple of weeks back. If I remember rightly,
the page found by __find_page_nolock() cannot be other than a swapcache
page, and will always have PageSwapCache bit set... until pagecache_lock
is dropped on return to its only caller lookup_swap_cache(). In which the
if (!PageSwapCache(found))
BUG();
if (found->mapping != &swapper_space)
BUG();
are not safe, since there may a concurrent remove_from_swap_cache(),
either from try_to_unuse() or from Rik's new vm_swap_full() deletion.
Those tests would be safe if the page were locked, but it's not.

I say find_get_swapcache_page() serves no purpose, should be deleted,
and find_get_page() used instead. That was one of various things in
the swapoff patch I posted to linux-mm on 16 Aug, which I need to
finish off, cut into pieces and submit to Linus.

Hugh

-
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/