[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221208180209.50845-6-ryncsn@gmail.com>
Date: Fri, 9 Dec 2022 02:02:09 +0800
From: Kairui Song <ryncsn@...il.com>
To: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Miaohe Lin <linmiaohe@...wei.com>,
David Hildenbrand <david@...hat.com>,
"Huang, Ying" <ying.huang@...el.com>,
Hugh Dickins <hughd@...gle.com>,
Kairui Song <kasong@...cent.com>
Subject: [PATCH 5/5] swap: avoid ra statistic lost when swapin races
From: Kairui Song <kasong@...cent.com>
__read_swap_cache_async should just call swap_cache_get_folio for trying
to look up the swap cache. Because swap_cache_get_folio handles the
readahead statistic, and clears the RA flag, looking up the cache
directly will skip these parts.
And the comment no longer applies after commit 442701e7058b
("mm/swap: remove swap_cache_info statistics"), just remove them.
Fixes: 442701e7058b ("mm/swap: remove swap_cache_info statistics")
Signed-off-by: Kairui Song <kasong@...cent.com>
---
mm/swap_state.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/mm/swap_state.c b/mm/swap_state.c
index eba388f67741..f39cfb62551d 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -418,15 +418,12 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
for (;;) {
int err;
/*
- * First check the swap cache. Since this is normally
- * called after swap_cache_get_folio() failed, re-calling
- * that would confuse statistics.
+ * First check the swap cache in case of race.
*/
si = get_swap_device(entry);
if (!si)
return NULL;
- folio = filemap_get_folio(swap_address_space(entry),
- swp_offset(entry));
+ folio = swap_cache_get_folio(entry, vma, addr);
put_swap_device(si);
if (folio)
return folio_file_page(folio, swp_offset(entry));
--
2.35.2
Powered by blists - more mailing lists