]> git.karo-electronics.de Git - karo-tx-linux.git/commit
Convert shmem_writepage() to use shmem_delete_from_page_cache() to use
authorHugh Dickins <hughd@google.com>
Tue, 26 Jul 2011 10:14:54 +0000 (20:14 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 29 Jul 2011 05:53:07 +0000 (15:53 +1000)
commit591f03ce1722d5865e6afc1ceccc73b960f2ee3e
tree77e1d68458faf4d94cd0670bbf691a720b0473b2
parentf47b8e42202c6455b6ee0380fd601128837e690b
Convert shmem_writepage() to use shmem_delete_from_page_cache() to use
shmem_radix_tree_replace() to substitute swap entry for page pointer
atomically in the radix tree.

As with shmem_add_to_page_cache(), it's not entirely satisfactory to be
copying such code from delete_from_swap_cache, but again judged easier to
sell than making its other callers go through the extras.

Remove the toy implementation's shmem_put_swap() and shmem_get_swap(), now
unreferenced, and the hack to disable swap: it's now good to go.

The way things have worked out, info->lock no longer helps to guard the
shmem_swaplist: we increment swapped under shmem_swaplist_mutex only.
That global mutex exclusion between shmem_writepage() and shmem_unuse() is
not pretty, and we ought to find another way; but it's been forced on us
by recent race discoveries, not a consequence of this patchset.

And what has become of the WARN_ON_ONCE(1) free_swap_and_cache() if a swap
entry was found already present?  That's no longer possible, the (unknown)
one inserting this page into filecache would hit the swap entry occupying
that slot.

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c