lkml.org 
[lkml]   [2022]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] mm/swapfile: avoid confusing swap cache statistics
Date
At swapoff time, we're going to swap in the pages continuously. So calling
lookup_swap_cache would confuse statistics. We should use find_get_page
directly here.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/swapfile.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 960d14a4b19e..e033a53a99df 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1865,7 +1865,12 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
offset = swp_offset(entry);
pte_unmap(pte);
swap_map = &si->swap_map[offset];
- page = lookup_swap_cache(entry, vma, addr);
+ /*
+ * Since we're going to swap in the pages continuously,
+ * calling lookup_swap_cache() would confuse statistics.
+ */
+ page = find_get_page(swap_address_space(entry),
+ swp_offset(entry));
if (!page) {
struct vm_fault vmf = {
.vma = vma,
--
2.23.0
\
 
 \ /
  Last update: 2022-05-27 11:27    [W:0.068 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site