summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2017-12-04 03:13:54 -0500
committerMatthew Wilcox <willy@infradead.org>2018-10-21 10:46:40 -0400
commitc121d3bb717ee932caf031c6a7923547f7f83163 (patch)
tree507bb4c1860a43c73b5b7d383a797c77c3b9c3ed /mm
parent7b8d046fba91d62beb8a8f78244aaa3c23a60cdd (diff)
shmem: Convert shmem_free_swap to XArray
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>
Diffstat (limited to 'mm')
-rw-r--r--mm/shmem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 608c9252248f..8e9bbfb7ed15 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -650,7 +650,7 @@ static void shmem_delete_from_page_cache(struct page *page, void *radswap)
650} 650}
651 651
652/* 652/*
653 * Remove swap entry from radix tree, free the swap and its page cache. 653 * Remove swap entry from page cache, free the swap and its page cache.
654 */ 654 */
655static int shmem_free_swap(struct address_space *mapping, 655static int shmem_free_swap(struct address_space *mapping,
656 pgoff_t index, void *radswap) 656 pgoff_t index, void *radswap)
@@ -658,7 +658,7 @@ static int shmem_free_swap(struct address_space *mapping,
658 void *old; 658 void *old;
659 659
660 xa_lock_irq(&mapping->i_pages); 660 xa_lock_irq(&mapping->i_pages);
661 old = radix_tree_delete_item(&mapping->i_pages, index, radswap); 661 old = __xa_cmpxchg(&mapping->i_pages, index, radswap, NULL, 0);
662 xa_unlock_irq(&mapping->i_pages); 662 xa_unlock_irq(&mapping->i_pages);
663 if (old != radswap) 663 if (old != radswap)
664 return -ENOENT; 664 return -ENOENT;