diff mbox series

[5/5] mm/swap: simplify the code of find_get_incore_page()

Message ID 20210518135352.3705306-6-linmiaohe@huawei.com (mailing list archive)
State New, archived
Headers show
Series Cleanups for swap | expand

Commit Message

Miaohe Lin May 18, 2021, 1:53 p.m. UTC
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@huawei.com>
---
 mm/swap_state.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Matthew Wilcox May 18, 2021, 2:33 p.m. UTC | #1
On Tue, May 18, 2021 at 09:53:52PM +0800, Miaohe Lin wrote:
> pagecache_get_page() can do find_subpage() for us if we do not specify
> FGP_HEAD. No functional change intended.

Please, no.  This interferes with the folio work.
Andrew Morton May 18, 2021, 9:13 p.m. UTC | #2
On Tue, 18 May 2021 15:33:54 +0100 Matthew Wilcox <willy@infradead.org> wrote:

> On Tue, May 18, 2021 at 09:53:52PM +0800, Miaohe Lin wrote:
> > pagecache_get_page() can do find_subpage() for us if we do not specify
> > FGP_HEAD. No functional change intended.
> 
> Please, no.  This interferes with the folio work.

In what way?  Can't the folio patches simply revert this or suitably
alter it?
Matthew Wilcox May 18, 2021, 9:34 p.m. UTC | #3
On Tue, May 18, 2021 at 02:13:04PM -0700, Andrew Morton wrote:
> On Tue, 18 May 2021 15:33:54 +0100 Matthew Wilcox <willy@infradead.org> wrote:
> 
> > On Tue, May 18, 2021 at 09:53:52PM +0800, Miaohe Lin wrote:
> > > pagecache_get_page() can do find_subpage() for us if we do not specify
> > > FGP_HEAD. No functional change intended.
> > 
> > Please, no.  This interferes with the folio work.
> 
> In what way?  Can't the folio patches simply revert this or suitably
> alter it?

Of course, it's just software.  Anything can just be modified.  I don't
see the point of putting in a cleanup patch that creates a conflict with
important work.
Miaohe Lin May 19, 2021, 1:39 a.m. UTC | #4
On 2021/5/19 5:34, Matthew Wilcox wrote:
> On Tue, May 18, 2021 at 02:13:04PM -0700, Andrew Morton wrote:
>> On Tue, 18 May 2021 15:33:54 +0100 Matthew Wilcox <willy@infradead.org> wrote:
>>
>>> On Tue, May 18, 2021 at 09:53:52PM +0800, Miaohe Lin wrote:
>>>> pagecache_get_page() can do find_subpage() for us if we do not specify
>>>> FGP_HEAD. No functional change intended.
>>>
>>> Please, no.  This interferes with the folio work.
>>
>> In what way?  Can't the folio patches simply revert this or suitably
>> alter it?
> 
> Of course, it's just software.  Anything can just be modified.  I don't
> see the point of putting in a cleanup patch that creates a conflict with
> important work.

I could hold this patch out until folio work is done if you ask for it.
Thanks.

> .
>
diff mbox series

Patch

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;