From: Matthew Wilcox (Oracle) Date: Thu, 31 Dec 2020 22:04:15 +0000 (+0000) Subject: mm/swap: optimise get_shadow_from_swap_cache X-Git-Tag: howlett/maple_spf/20210104~145 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=348484d1f320e45e32dea2c962aca1aa72a832a0;p=users%2Fjedix%2Flinux-maple.git mm/swap: optimise get_shadow_from_swap_cache There's no need to get a reference to the page, just load the entry and see if it's a shadow entry. Link: https://lkml.kernel.org/r/20201112212641.27837-4-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Cc: Dave Chinner Cc: Hugh Dickins Cc: Jan Kara Cc: Johannes Weiner Cc: Kirill A. Shutemov Cc: William Kucharski Cc: Yang Shi Signed-off-by: Andrew Morton --- diff --git a/mm/swap_state.c b/mm/swap_state.c index cbce6f28d32f..d3ccfab6c9b7 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; }