shmem: Convert shmem_confirm_swap to XArray
authorMatthew Wilcox <willy@infradead.org>
Wed, 22 Nov 2017 13:34:58 +0000 (08:34 -0500)
committerMatthew Wilcox <willy@infradead.org>
Sun, 21 Oct 2018 14:46:39 +0000 (10:46 -0400)
xa_load has its own RCU locking, so we can eliminate it here.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
mm/shmem.c

index 5697c8fecdfcb747ee1e725d7751eaee44dab1f3..ce91569426f36d3cd2874deb4d34f61c7bed4fd8 100644 (file)
@@ -349,12 +349,7 @@ static int shmem_replace_entry(struct address_space *mapping,
 static bool shmem_confirm_swap(struct address_space *mapping,
                               pgoff_t index, swp_entry_t swap)
 {
-       void *item;
-
-       rcu_read_lock();
-       item = radix_tree_lookup(&mapping->i_pages, index);
-       rcu_read_unlock();
-       return item == swp_to_radix_entry(swap);
+       return xa_load(&mapping->i_pages, index) == swp_to_radix_entry(swap);
 }
 
 /*