Skip to content

Commit

Permalink
shmem: Convert shmem_free_swap to XArray
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthew Wilcox committed Oct 21, 2018
1 parent 7b8d046 commit c121d3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,15 +650,15 @@ 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)
{
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;
Expand Down

0 comments on commit c121d3b

Please sign in to comment.