lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220527092626.31883-3-linmiaohe@huawei.com>
Date:   Fri, 27 May 2022 17:26:25 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     <akpm@...ux-foundation.org>
CC:     <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        <linmiaohe@...wei.com>
Subject: [PATCH 2/3] mm/swapfile: avoid confusing swap cache statistics

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@...wei.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ