From: "Zi Yan" <ziy@nvidia.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
<linux-fsdevel@vger.kernel.org>,
"David Hildenbrand" <david@redhat.com>,
"Joanne Koong" <joannelkoong@gmail.com>
Cc: <linux-mm@kvack.org>, <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 06/11] migrate: Remove call to ->writepage
Date: Thu, 27 Mar 2025 11:04:57 -0400 [thread overview]
Message-ID: <D8R539L45F9P.3PIKZ5DUGGVS8@nvidia.com> (raw)
In-Reply-To: <20250307135414.2987755-7-willy@infradead.org>
On Fri Mar 7, 2025 at 8:54 AM EST, Matthew Wilcox (Oracle) wrote:
> The writepage callback is going away; filesystems must implement
> migrate_folio or else dirty folios will not be migratable.
What is the impact of this? Are there any filesystem that has
a_ops->writepage() without migrate_folio()? I wonder if it could make
the un-migratable problem worse[1] when such FS exists.
[1] https://lore.kernel.org/linux-mm/882b566c-34d6-4e68-9447-6c74a0693f18@redhat.com/
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> mm/migrate.c | 57 ++++------------------------------------------------
> 1 file changed, 4 insertions(+), 53 deletions(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index c0adea67cd62..3d1d9d49fb8e 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -944,67 +944,18 @@ int filemap_migrate_folio(struct address_space *mapping,
> }
> EXPORT_SYMBOL_GPL(filemap_migrate_folio);
>
> -/*
> - * Writeback a folio to clean the dirty state
> - */
> -static int writeout(struct address_space *mapping, struct folio *folio)
> -{
> - struct writeback_control wbc = {
> - .sync_mode = WB_SYNC_NONE,
> - .nr_to_write = 1,
> - .range_start = 0,
> - .range_end = LLONG_MAX,
> - .for_reclaim = 1
> - };
> - int rc;
> -
> - if (!mapping->a_ops->writepage)
> - /* No write method for the address space */
> - return -EINVAL;
> -
> - if (!folio_clear_dirty_for_io(folio))
> - /* Someone else already triggered a write */
> - return -EAGAIN;
> -
> - /*
> - * A dirty folio may imply that the underlying filesystem has
> - * the folio on some queue. So the folio must be clean for
> - * migration. Writeout may mean we lose the lock and the
> - * folio state is no longer what we checked for earlier.
> - * At this point we know that the migration attempt cannot
> - * be successful.
> - */
> - remove_migration_ptes(folio, folio, 0);
> -
> - rc = mapping->a_ops->writepage(&folio->page, &wbc);
> -
> - if (rc != AOP_WRITEPAGE_ACTIVATE)
> - /* unlocked. Relock */
> - folio_lock(folio);
> -
> - return (rc < 0) ? -EIO : -EAGAIN;
> -}
> -
> /*
> * Default handling if a filesystem does not provide a migration function.
> */
> static int fallback_migrate_folio(struct address_space *mapping,
> struct folio *dst, struct folio *src, enum migrate_mode mode)
> {
> - if (folio_test_dirty(src)) {
> - /* Only writeback folios in full synchronous migration */
> - switch (mode) {
> - case MIGRATE_SYNC:
> - break;
> - default:
> - return -EBUSY;
> - }
> - return writeout(mapping, src);
> - }
Now fallback_migrate_folio() no longer writes out page for FS, so it is
the responsibilty of migrate_folio()?
+Joanne, since she is touching the above code in the FUSE temp page removal
patchset.
> + if (folio_test_dirty(src))
> + return -EBUSY;
>
> /*
> - * Buffers may be managed in a filesystem specific way.
> - * We must have no buffers or drop them.
> + * Filesystem may have private data at folio->private that we
> + * can't migrate automatically.
> */
> if (!filemap_release_folio(src, GFP_KERNEL))
> return mode == MIGRATE_SYNC ? -EAGAIN : -EBUSY;
--
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2025-03-27 15:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 13:54 [PATCH 00/11] Remove aops->writepage Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 01/11] f2fs: Remove check for ->writepage Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 02/11] f2fs: Remove f2fs_write_data_page() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 03/11] f2fs: Remove f2fs_write_meta_page() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 04/11] f2fs: Remove f2fs_write_node_page() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 05/11] vboxsf: Convert to writepages Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 06/11] migrate: Remove call to ->writepage Matthew Wilcox (Oracle)
2025-03-27 15:04 ` Zi Yan [this message]
2025-03-27 16:52 ` Matthew Wilcox
2025-03-27 17:22 ` Zi Yan
2025-04-01 13:32 ` David Hildenbrand
2025-03-07 13:54 ` [PATCH 07/11] writeback: Remove writeback_use_writepage() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 08/11] shmem: Add shmem_writeout() Matthew Wilcox (Oracle)
2025-03-08 5:31 ` Baolin Wang
2025-03-07 13:54 ` [PATCH 09/11] i915: Use writeback_iter() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 10/11] mm: Remove swap_writepage() and shmem_writepage() Matthew Wilcox (Oracle)
2025-03-08 5:34 ` Baolin Wang
2025-03-07 13:54 ` [PATCH 11/11] fs: Remove aops->writepage Matthew Wilcox (Oracle)
2025-03-17 1:08 ` Fan Ni
2025-03-17 3:22 ` Matthew Wilcox
2025-03-17 22:30 ` Matthew Wilcox
2025-03-18 8:10 ` Thomas Hellström
2025-04-01 16:26 ` Matthew Wilcox
2025-05-02 14:33 ` Thomas Hellström
2025-03-28 9:40 ` [PATCH 00/11] " Christian Brauner
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=D8R539L45F9P.3PIKZ5DUGGVS8@nvidia.com \
--to=ziy@nvidia.com \
--cc=david@redhat.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox