Re: [PATCH v3] mm/migrate.c: Rework migration_entry_wait() to not take a pageref

From: Matthew Wilcox
Date: Mon Nov 15 2021 - 20:26:54 EST


On Mon, Nov 15, 2021 at 09:52:22PM +1100, Alistair Popple wrote:
> +#ifdef CONFIG_MIGRATION
> +/**
> + * migration_entry_wait_on_locked - Wait for a migration entry to be removed
> + * @page: page referenced by the migration entry.

This should be @folio (you can test by running 'make htmldocs', or even
'make W=1'

> + * @ptep: mapped pte pointer. This function will return with the ptep unmapped.
> + * @ptl: already locked ptl. This function will drop the lock.
> + *
> + * Wait for a migration entry referencing the given page to be removed. This is
> + * equivalent to put_and_wait_on_page_locked(page, TASK_UNINTERRUPTIBLE) except
> + * this can be called without taking a reference on the page. Instead this
> + * should be called while holding the ptl for the migration entry referencing
> + * the page.

The tool won't tell you to update these page references to be folio
references ... so I will ;-)

> +++ b/mm/migrate.c
> @@ -305,15 +305,7 @@ void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
> page = pfn_swap_entry_to_page(entry);
> page = compound_head(page);

I think this whole function should be folio-based. That is:

- struct page *page;
+ struct folio *folio;

and
folio = page_folio(pfn_swap_entry_to_page(entry));