Re: [RFC] mm: introduce page pinner

From: Matthew Wilcox
Date: Wed Dec 08 2021 - 09:24:21 EST


On Wed, Dec 08, 2021 at 07:54:35PM +0800, 胡玮文 wrote:
> @@ -406,6 +409,7 @@ int folio_migrate_mapping(struct address_space *mapping,
> xas_lock_irq(&xas);
> if (!folio_ref_freeze(folio, expected_count)) {
> xas_unlock_irq(&xas);
> + page_pinner_failure(&folio->page);
> return -EAGAIN;
> }
>
> I'm not sure what to do with the new folio, it seems using folio->page in new
> codes is not correct.

It's a transitional measure. Once everything that should be converted
to folios has been converted, it can go away.

Tail pages don't have their own refcounts, so the page pinner should
actually be the folio pinner. I hadn't bothered to point this out
because we're in the early days of the folio transition and it'd be
unreasonable to criticise Minchan for not converting his patch from
pages to folios.