aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <[email protected]>2021-02-25 17:15:33 -0800
committerLinus Torvalds <[email protected]>2021-02-26 09:40:59 -0800
commit8c647dd1e39573f23a4ca25c09f82716b70e702c (patch)
treec15c1ce8efa944dfbe899e423b4c20f84d385df4
parent96888e0ab0e652eb3036eff0cb0664a96cb7e9a9 (diff)
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/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: Dave Chinner <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Jan Kara <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: William Kucharski <[email protected]> Cc: Yang Shi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/swap_state.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c
index c1a648d9092b..f270c30d4681 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -87,11 +87,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;
}