There's no need to get a reference to the page, just load the entry and
see if it's a shadow entry.

Signed-off-by: Matthew Wilcox (Oracle) <wi...@infradead.org>
---
 mm/swap_state.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/swap_state.c b/mm/swap_state.c
index cf7b322a9abc..d2161154d873 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -113,11 +113,9 @@ void *get_shadow_from_swap_cache(swp_entry_t entry)
        pgoff_t idx = swp_offset(entry);
        struct page *page;
 
-       page = find_get_entry(address_space, idx);
+       page = xa_load(&address_space->i_pages, idx);
        if (xa_is_value(page))
                return page;
-       if (page)
-               put_page(page);
        return NULL;
 }
 
-- 
2.28.0

Reply via email to