From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<linmiaohe@huawei.com>
Subject: [PATCH] mm/swap: simplify the code of find_get_incore_page()
Date: Wed, 16 Mar 2022 15:59:41 +0800 [thread overview]
Message-ID: <20220316075941.44816-1-linmiaohe@huawei.com> (raw)
pagecache_get_page() can return subpage for us if we do not specify
FGP_HEAD. No functional change intended.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.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 ee67164531c0..517b4b856e32 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -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;
--
2.23.0
next reply other threads:[~2022-03-16 8:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 7:59 Miaohe Lin [this message]
2022-03-16 12:25 ` Matthew Wilcox
2022-03-17 1:43 ` Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220316075941.44816-1-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox