Re: [PATCH v2 7/8] mm/migrate: enable noref migration for jbd2

Jan Kara
2025-04-10T13:40:43Z

On Wed 09-04-25 18:49:44, Luis Chamberlain wrote:
> From: Davidlohr Bueso <dave@stgolabs.net>
>
> Add semantics to enable future optimizations for buffer head noref jbd2
> migration. This adds a new BH_Migrate flag which ensures we can bail
> on the lookup path. This should enable jbd2 to get semantics of when
> a buffer head is under folio migration, and should yield to it and to
> eventually remove the buffer_meta() check skipping current jbd2 folio
> migration.
>
> Suggested-by: Jan Kara <jack@suse.cz>
> Co-developed-by: Luis Chamberlain <mcgrof@kernel.org>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

..

> diff --git a/mm/migrate.c b/mm/migrate.c
> index 32fa72ba10b4..8fed2655f2e8 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -851,6 +851,8 @@ static int __buffer_migrate_folio(struct address_space *mapping,
> bool busy;
> bool invalidated = false;
>
> + VM_WARN_ON_ONCE(test_and_set_bit_lock(BH_Migrate,
> + &head->b_state));

Careful here. This breaks the logic with !CONFIG_DEBUG_VM.

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR