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: <20210518135352.3705306-6-linmiaohe@huawei.com>
Date:   Tue, 18 May 2021 21:53:52 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     <akpm@...ux-foundation.org>
CC:     <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
        <linmiaohe@...wei.com>
Subject: [PATCH 5/5] mm/swap: simplify the code of find_get_incore_page()

pagecache_get_page() can do find_subpage() for us if we do not specify
FGP_HEAD. No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
 mm/swap_state.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/mm/swap_state.c b/mm/swap_state.c
index a55b7b74b0e6..bc92e4893fec 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -394,13 +394,11 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index)
 {
 	swp_entry_t swp;
 	struct swap_info_struct *si;
-	struct page *page = pagecache_get_page(mapping, index,
-						FGP_ENTRY | FGP_HEAD, 0);
+	struct page *page = pagecache_get_page(mapping, index, FGP_ENTRY, 0);
 
-	if (!page)
+	if (!page || !xa_is_value(page))
 		return page;
-	if (!xa_is_value(page))
-		return find_subpage(page, index);
+
 	if (!shmem_mapping(mapping))
 		return NULL;
 
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ