Skip to contentSkip to conversation

mm/swap: simplify the code of find_get_incore_page()

PATCH In review Miaohe Lin 2 participants 3 messages Mar 16, 2022 – Mar 17, 2022

Subsystems (2)
lore
Share & tools
lore

Miaohe Lin

author
#0 lore raw

PATCH 1/1 mm/swap: simplify the code of find_get_incore_page()

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

---
 mm/swap_state.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
mm/swap_state.c +2 -5
index ee67164531c0..517b4b856e32 100644
@@ -394,13 +394,10 @@ 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;
 
Signature · 1 line
2.23.0
#1 lore raw
Quoted 2 lines · Miaohe Lin

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

No, I'm converting this to folios soon.

author
#2 lore raw
Quoted 5 lines · Matthew Wilcox
Quoted 2 lines · Miaohe Lin

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

No, I'm converting this to folios soon.

This patch is based on linux-next-20220315 where pagecache_get_page is already converted to folios. What you mean is find_get_incore_page will convert to folis too soon? I'll continue to delay this patch anyway.

Thanks.

Quoted 3 lines

.