All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	hch@infradead.org, david@fromorbit.com,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, cl@linux.com, mike.kravetz@oracle.com
Subject: Re: [RFC PATCH V2 0/9] Introduce attach/clear_page_private to cleanup code
Date: Sat, 2 May 2020 10:56:51 +0200	[thread overview]
Message-ID: <e4d5ddc0-877f-6499-f697-2b7c0ddbf386@cloud.ionos.com> (raw)
In-Reply-To: <20200502004158.GD29705@bombadil.infradead.org>

On 5/2/20 2:41 AM, Matthew Wilcox wrote:
> On Sat, May 02, 2020 at 12:42:15AM +0200, Guoqing Jiang wrote:
>> On 5/2/20 12:16 AM, Matthew Wilcox wrote:
>>> On Thu, Apr 30, 2020 at 11:44:41PM +0200, Guoqing Jiang wrote:
>>>>     include/linux/pagemap.h: introduce attach/clear_page_private
>>>>     md: remove __clear_page_buffers and use attach/clear_page_private
>>>>     btrfs: use attach/clear_page_private
>>>>     fs/buffer.c: use attach/clear_page_private
>>>>     f2fs: use attach/clear_page_private
>>>>     iomap: use attach/clear_page_private
>>>>     ntfs: replace attach_page_buffers with attach_page_private
>>>>     orangefs: use attach/clear_page_private
>>>>     buffer_head.h: remove attach_page_buffers
>>> I think mm/migrate.c could also use this:
>>>
>>>           ClearPagePrivate(page);
>>>           set_page_private(newpage, page_private(page));
>>>           set_page_private(page, 0);
>>>           put_page(page);
>>>           get_page(newpage);
>>>
>> Thanks for checking!  Assume the below change is appropriate.
>>
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index 7160c1556f79..f214adfb3fa4 100644
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -797,10 +797,7 @@ static int __buffer_migrate_page(struct address_space
>> *mapping,
>>          if (rc != MIGRATEPAGE_SUCCESS)
>>                  goto unlock_buffers;
>>
>> -       ClearPagePrivate(page);
>> -       set_page_private(newpage, page_private(page));
>> -       set_page_private(page, 0);
>> -       put_page(page);
>> +       set_page_private(newpage, detach_page_private(page));
>>          get_page(newpage);
> I think you can do:
>
> @@ -797,11 +797,7 @@ static int __buffer_migrate_page(struct address_space *mapping,
>          if (rc != MIGRATEPAGE_SUCCESS)
>                  goto unlock_buffers;
>   
> -       ClearPagePrivate(page);
> -       set_page_private(newpage, page_private(page));
> -       set_page_private(page, 0);
> -       put_page(page);
> -       get_page(newpage);
> +       attach_page_private(newpage, detach_page_private(page));
>   
>          bh = head;
>          do {
> @@ -810,8 +806,6 @@ static int __buffer_migrate_page(struct address_space *mapping,
>   
>          } while (bh != head);
>   
> -       SetPagePrivate(newpage);
> -
>          if (mode != MIGRATE_SYNC_NO_COPY)
>
> ... but maybe there's a subtlety to the ordering of the setup of the bh
> and setting PagePrivate that means what you have there is a better patch.

Yes, it is better but not sure if the order can be changed here. And seems
the original commit is this one.

commit e965f9630c651fa4249039fd4b80c9392d07a856
Author: Christoph Lameter <clameter@sgi.com>
Date:   Wed Feb 1 03:05:41 2006 -0800

     [PATCH] Direct Migration V9: Avoid writeback / page_migrate() method

     Migrate a page with buffers without requiring writeback

     This introduces a new address space operation migratepage() that 
may be used
     by a filesystem to implement its own version of page migration.

     A version is provided that migrates buffers attached to pages. Some
     filesystems (ext2, ext3, xfs) are modified to utilize this feature.

     The swapper address space operation are modified so that a regular
     migrate_page() will occur for anonymous pages without writeback 
(migrate_pages
     forces every anonymous page to have a swap entry).

Hope mm experts could take a look, so CC more people and mm list. And
the question is that if we can setting PagePrivate before setup bh in the
__buffer_migrate_page, thanks for your any further input.

Thanks,
Guoqing

      reply	other threads:[~2020-05-02  8:56 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 21:44 [RFC PATCH V2 0/9] Introduce attach/clear_page_private to cleanup code Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 1/9] include/linux/pagemap.h: introduce attach/clear_page_private Guoqing Jiang
2020-04-30 21:44   ` [f2fs-dev] " Guoqing Jiang
2020-04-30 21:44   ` Guoqing Jiang
2020-04-30 22:10   ` Andreas Grünbacher
2020-04-30 22:10     ` [f2fs-dev] " Andreas Grünbacher
2020-04-30 22:10     ` Andreas Grünbacher
2020-05-01  6:38     ` Guoqing Jiang
2020-05-01  6:38       ` [f2fs-dev] " Guoqing Jiang
2020-05-01  6:38       ` Guoqing Jiang
2020-04-30 22:13   ` Matthew Wilcox
2020-04-30 22:13     ` [f2fs-dev] " Matthew Wilcox
2020-04-30 22:13     ` Matthew Wilcox
2020-05-01  1:42     ` Al Viro
2020-05-01  1:42       ` [f2fs-dev] " Al Viro
2020-05-01  1:42       ` Al Viro
2020-05-01  1:49       ` Al Viro
2020-05-01  1:49         ` [f2fs-dev] " Al Viro
2020-05-01  1:49         ` Al Viro
2020-05-01  6:41         ` Guoqing Jiang
2020-05-01  6:41           ` [f2fs-dev] " Guoqing Jiang
2020-05-01  6:41           ` Guoqing Jiang
2020-05-01  6:39     ` Guoqing Jiang
2020-05-01  6:39       ` [f2fs-dev] " Guoqing Jiang
2020-05-01  6:39       ` Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 2/9] md: remove __clear_page_buffers and use attach/clear_page_private Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 3/9] btrfs: " Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 4/9] fs/buffer.c: " Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 5/9] f2fs: " Guoqing Jiang
2020-04-30 21:44   ` [f2fs-dev] " Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 6/9] iomap: " Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 7/9] ntfs: replace attach_page_buffers with attach_page_private Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 8/9] orangefs: use attach/clear_page_private Guoqing Jiang
2020-04-30 21:44 ` [RFC PATCH V2 9/9] buffer_head.h: remove attach_page_buffers Guoqing Jiang
2020-05-01 22:16 ` [RFC PATCH V2 0/9] Introduce attach/clear_page_private to cleanup code Matthew Wilcox
2020-05-01 22:42   ` Guoqing Jiang
2020-05-02  0:41     ` Matthew Wilcox
2020-05-02  8:56       ` Guoqing Jiang [this message]

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=e4d5ddc0-877f-6499-f697-2b7c0ddbf386@cloud.ionos.com \
    --to=guoqing.jiang@cloud.ionos.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.