]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
shmem: Convert shmem_free_swap to XArray
authorMatthew Wilcox <willy@infradead.org>
Mon, 4 Dec 2017 08:13:54 +0000 (03:13 -0500)
committerMatthew Wilcox <willy@infradead.org>
Sun, 21 Oct 2018 14:46:40 +0000 (10:46 -0400)
Since we are conditionally storing NULL in the XArray, we do not need
to allocate memory and the GFP flags will be unused.

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

index 608c9252248f42a412fa5001f1f873dc8e5331ca..8e9bbfb7ed154ea0656c93d2983fcda1c6c3486c 100644 (file)
@@ -650,7 +650,7 @@ static void shmem_delete_from_page_cache(struct page *page, void *radswap)
 }
 
 /*
- * Remove swap entry from radix tree, free the swap and its page cache.
+ * Remove swap entry from page cache, free the swap and its page cache.
  */
 static int shmem_free_swap(struct address_space *mapping,
                           pgoff_t index, void *radswap)
@@ -658,7 +658,7 @@ static int shmem_free_swap(struct address_space *mapping,
        void *old;
 
        xa_lock_irq(&mapping->i_pages);
-       old = radix_tree_delete_item(&mapping->i_pages, index, radswap);
+       old = __xa_cmpxchg(&mapping->i_pages, index, radswap, NULL, 0);
        xa_unlock_irq(&mapping->i_pages);
        if (old != radswap)
                return -ENOENT;