Message ID | 20201112212641.27837-4-willy@infradead.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Overhaul multi-page lookups for THP | expand |
On Thu, Nov 12, 2020 at 09:26:28PM +0000, Matthew Wilcox (Oracle) wrote: > 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) <willy@infradead.org> Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de>
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; }
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) <willy@infradead.org> --- mm/swap_state.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)